Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED Cant read css or any scripts in my webpage

Discussion in 'General Discussion' started by chris0147, Feb 5, 2018.

  1. chris0147

    chris0147 Well-Known Member

    Joined:
    Aug 28, 2015
    Messages:
    60
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    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.
     
  2. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    835
    Likes Received:
    302
    Trophy Points:
    113
    Location:
    Spain
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. chris0147

    chris0147 Well-Known Member

    Joined:
    Aug 28, 2015
    Messages:
    60
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    London
    cPanel Access Level:
    Root Administrator
    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??
     
  4. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,762
    Likes Received:
    116
    Trophy Points:
    343
    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?
     
  5. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    835
    Likes Received:
    302
    Trophy Points:
    113
    Location:
    Spain
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #5 rpvw, Feb 5, 2018
    Last edited: Feb 5, 2018
  6. chris0147

    chris0147 Well-Known Member

    Joined:
    Aug 28, 2015
    Messages:
    60
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    London
    cPanel Access Level:
    Root Administrator
    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??
     
  7. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,762
    Likes Received:
    116
    Trophy Points:
    343
    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
     
  8. chris0147

    chris0147 Well-Known Member

    Joined:
    Aug 28, 2015
    Messages:
    60
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    London
    cPanel Access Level:
    Root Administrator
    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.
     
  9. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,762
    Likes Received:
    116
    Trophy Points:
    343
    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?
     
  10. chris0147

    chris0147 Well-Known Member

    Joined:
    Aug 28, 2015
    Messages:
    60
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    London
    cPanel Access Level:
    Root Administrator
    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.
     
  11. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,762
    Likes Received:
    116
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    Then what specifically do you see?
     
  12. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    835
    Likes Received:
    302
    Trophy Points:
    113
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    I wonder if they added anything into any of the htaccess files ? Check the file modification dates.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. chris0147

    chris0147 Well-Known Member

    Joined:
    Aug 28, 2015
    Messages:
    60
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    London
    cPanel Access Level:
    Root Administrator
    At all I can see is a blank screen when I try to read my css file.
     
  14. chris0147

    chris0147 Well-Known Member

    Joined:
    Aug 28, 2015
    Messages:
    60
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    London
    cPanel Access Level:
    Root Administrator
    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>
    
     
  15. chris0147

    chris0147 Well-Known Member

    Joined:
    Aug 28, 2015
    Messages:
    60
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    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! :)
     
  16. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    835
    Likes Received:
    302
    Trophy Points:
    113
    Location:
    Spain
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. chris0147

    chris0147 Well-Known Member

    Joined:
    Aug 28, 2015
    Messages:
    60
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    London
    cPanel Access Level:
    Root Administrator
    Thank you very much for this, I have copied and pasted by using the 3.5 version and it's working great again. Thank you!
     
  18. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    I'm glad to see the responses were helpful. I've marked this thread as solved.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice