SOLVED Cant read css or any scripts in my webpage

chris0147

Well-Known Member
Aug 28, 2015
104
2
68
London
cPanel Access Level
Root Administrator
Hi all,

I need your help, I have got a problem with reading my css files on my webpage as it have stop it working. Some idiots that I hired on freelancer, he have changed the whole things that make things stop working especially the files and folder permissions where I could not see the files and folders. I had asked him to fix it and he came to fixed it and got it working, but i cant read the css files. It was working fine before.

What he used in the putty commend:

Code:
chown -R myusername:myusername public_html

I can be able to get access to my website with no problem, but then I can't be able to read my css files after he made the changes. I have changed the public_html and files_backup folders permissions to 755, I can read my php and images files with no problem, but i cant read any of css files or any other scripts. :(

There is something wrong that prevent me from reading it.

Can you please help me how I can be able to read my css and other language files in my webpage??

If you can be able to help me to get it working again that would be great. I have learned my lesson in the hard way to never trust anyone whoever ask me for ssh or anything I will refuse and find someone else who I can trust.
 

rpvw

Well-Known Member
Jul 18, 2013
1,101
465
113
UK
cPanel Access Level
Root Administrator
Folders should be 755 and all files should be 644

In shell terminal, you can bulk change using
Code:
find /home/<cpuser>/public_html/ -type f -exec chmod 644 {} \;

find /home/<cpuser>/public_html/* -type d -exec chmod 755 {} \;
Obviously change the <cpuser> for the actual username
 

chris0147

Well-Known Member
Aug 28, 2015
104
2
68
London
cPanel Access Level
Root Administrator
Folders should be 755 and all files should be 644

In shell terminal, you can bulk change using
Code:
find /home/<cpuser>/public_html/ -type f -exec chmod 644 {} \;

find /home/<cpuser>/public_html/* -type d -exec chmod 755 {} \;
Obviously change the <cpuser> for the actual username
Thanks for your quick reply, I have input both of them in the commend.

When I try it, I still cant be able to read my css, js or any language files.

Any idea??
 

sparek-3

Well-Known Member
Aug 10, 2002
2,039
229
368
cPanel Access Level
Root Administrator
What are the ownership and permissions of the specific css file?

ls -al /home/<cpuser>/public_html/path/to/css/file.css

What is the owernship and permissions of the user's home directory?

ls -ald /home/<cpuser>

The ownership and permissions of the /home/<cpuser>/public_html might should be <cpuser>:nobody and 750. But <cpuser>:<cpuser> and 755 should also work.

Edit: Is this referring to the account's main domain or is this referring to an addon domain? Something that might exist outside of the public_html folder?
 

rpvw

Well-Known Member
Jul 18, 2013
1,101
465
113
UK
cPanel Access Level
Root Administrator
Check the file ownership on a working site, if your dev chowned the files, you may need to chown them back

EDIT: sparek-3 posted while I was still messing about - I completely agree with what he advised.
 
Last edited:

chris0147

Well-Known Member
Aug 28, 2015
104
2
68
London
cPanel Access Level
Root Administrator
What are the ownership and permissions of the specific css file?

ls -al /home/<cpuser>/public_html/path/to/css/file.css

What is the owernship and permissions of the user's home directory?

ls -ald /home/<cpuser>

The ownership and permissions of the /home/<cpuser>/public_html might should be <cpuser>:nobody and 750. But <cpuser>:<cpuser> and 755 should also work.

Edit: Is this referring to the account's main domain or is this referring to an addon domain? Something that might exist outside of the public_html folder?
Ok here it is:

Code:
# ls -al /home/<cpuser>/public_html/files_backup/style.css
-rw-r--r-- 1 <cpuser> <cpuser> 17565 Feb  5 16:37 /home/<cpuser>/public_html/files_backup/style.css


#ls -ald /home/<cpuser>
drwx--x--x 21 <cpuser> <cpuser> 4096 Feb  1 00:46 /home/<cpuser>


#ls -ald /home/<cpuser>/public_html
drwxr-xr-x 21 <cpuser> <cpuser> 4096 Feb  5 17:02 /home/<cpuser>/public_html

Can you please paste the code that I could use in the ssh terminal for the <cpuser>:nobody 750 and 755??
 

sparek-3

Well-Known Member
Aug 10, 2002
2,039
229
368
cPanel Access Level
Root Administrator
Your issue does not appear to be permission related

What is the permissions of /home/<cpuser>/public_html/files_backup ?

ls -ald /home/<cpuser>/public_html/files_backup

Are you able to access the css file directory:

http://example.tld/files_backup/style.css
 

chris0147

Well-Known Member
Aug 28, 2015
104
2
68
London
cPanel Access Level
Root Administrator
Your issue does not appear to be permission related

What is the permissions of /home/<cpuser>/public_html/files_backup ?

ls -ald /home/<cpuser>/public_html/files_backup

Are you able to access the css file directory:

http://example.tld/files_backup/style.css
Here it is:

Code:
# ls -ald /home/<cpuser>/public_html/files_backup
drwxr-xr-x 3 <cpuser> <cpuser> 4096 Feb  5 16:37 /home/<cpuser>/public_html/files_backup

yes I can be able to access to the file directory but not the file. I cant read it.
 

sparek-3

Well-Known Member
Aug 10, 2002
2,039
229
368
cPanel Access Level
Root Administrator
What specific error message are you getting when you go to http://example.tld/files_backup/style.css

Are you sure your domain name is resolving to the account on your server?

You will have to review the Apache error log to figure out why Apache is denying permission. I do not know why.

What level of access did you give these people that made changes to your account? Did you give them root access?
 

chris0147

Well-Known Member
Aug 28, 2015
104
2
68
London
cPanel Access Level
Root Administrator
What specific error message are you getting when you go to http://example.tld/files_backup/style.css

Are you sure your domain name is resolving to the account on your server?

You will have to review the Apache error log to figure out why Apache is denying permission. I do not know why.

What level of access did you give these people that made changes to your account? Did you give them root access?
There is no error when I go to http://example.tld/files_backup/style.css

Yes I am sure that my domain name is resolving to the account on my server as I can be able get access to my domain and my files.

I dont know how I can review the Apache error log to figure out why Apache is denying the permission. You will have to tell me how and where it is so i will report it back.

Yes I did give them my root access to fix my server and then here it is.
 

rpvw

Well-Known Member
Jul 18, 2013
1,101
465
113
UK
cPanel Access Level
Root Administrator
I wonder if they added anything into any of the htaccess files ? Check the file modification dates.
 

chris0147

Well-Known Member
Aug 28, 2015
104
2
68
London
cPanel Access Level
Root Administrator
I wonder if they added anything into any of the htaccess files ? Check the file modification dates.
I don't think so. Here is the htaccess:

Code:
RewriteEngine On
RewriteBase /

<IfModule mod_rewrite.c>

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
 

chris0147

Well-Known Member
Aug 28, 2015
104
2
68
London
cPanel Access Level
Root Administrator
Just found the problem, there was a problem with htaccess.

I used this:

Code:
RewriteRule . index.php [L]
which it have stop me getting access to any files so i have removed it and now it is working again! :)
 

rpvw

Well-Known Member
Jul 18, 2013
1,101
465
113
UK
cPanel Access Level
Root Administrator
Just in case you need them, the official WP htaccess files, and tips and tricks, are published in their Codex :

htaccess « WordPress Codex
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,216
463
Hello,

I'm glad to see the responses were helpful. I've marked this thread as solved.