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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED Apache 2.4 deny from all blocks only css and js files

Discussion in 'EasyApache' started by Ardelean Vlad, Oct 27, 2017.

  1. Ardelean Vlad

    Ardelean Vlad Member

    Joined:
    Oct 27, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Romania
    cPanel Access Level:
    Root Administrator
    I`m using Apache 2.4 and cPanel v66.0.26 and I noticed that the deny from all directive is not working correctly anymore, it blocks only the css and js files, the website is displayed but without the design files.

    The problems seems to appear after some cPanel updates (a few month ago it worked correctly), but I`m not sure from which version the problem appeared.

    I also noticed that if I use in my .htaccess file only the directive "deny from all" it works, but if I use after that some rewrite rules the site is showing up without loading the css and js files.

    Is this an Apache configuration problem?
     
    #1 Ardelean Vlad, Oct 27, 2017
    Last edited by a moderator: Oct 27, 2017
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,782
    Likes Received:
    1,712
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you let us know the full contents of the .htaccess file?

    Thank you.
     
  3. Ardelean Vlad

    Ardelean Vlad Member

    Joined:
    Oct 27, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Romania
    cPanel Access Level:
    Root Administrator
    Hello,

    this is the full content of the .htaccess file :


    deny from all

    Options -Indexes

    # php -- BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php71” package as the default “PHP” programming language.
    <IfModule mime_module>
    AddType application/x-httpd-ea-php71 .php .php7 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^(testfolder.*$|index\.php$) - [L]
    ###redirect all php files to index.php
    RewriteRule ^([^.]+).php$ /index.php [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . /index.php [L]
    </IfModule>

    The problem appears for other account too, I can copy the .htaccess file from it too if you want.

    Thank you!
     
  4. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    618
    Likes Received:
    192
    Trophy Points:
    43
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    For Apache 2.4, you could try:
    Code:
    Require all denied

    Full details from https://httpd.apache.org/docs/trunk/upgrading.html
     
  5. Ardelean Vlad

    Ardelean Vlad Member

    Joined:
    Oct 27, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Romania
    cPanel Access Level:
    Root Administrator
    #5 Ardelean Vlad, Oct 30, 2017
    Last edited by a moderator: Oct 30, 2017
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,782
    Likes Received:
    1,712
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hi,

    Could you open a support ticket using the link in my signature so we can take a closer look?

    Thank you.
     
  7. Ardelean Vlad

    Ardelean Vlad Member

    Joined:
    Oct 27, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Romania
    cPanel Access Level:
    Root Administrator
    Hello,

    I opened a support ticket.

    Thank you!
     
  8. Ardelean Vlad

    Ardelean Vlad Member

    Joined:
    Oct 27, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Romania
    cPanel Access Level:
    Root Administrator
    Hello,

    the problem was solved by the cPanel support. Apparently the server couldn't find the 403 error page so the rewrite rule in the .htaccess "picks up" the request and attempts to process it.
    The solution was to use a rule for the error page like :
    ErrorDocument 403 "403 Error"

    in my .htaccess file, or to set the default error pages like I did now from WHM -> Service Configuration -> Apache Configuration -> Pre VirtualHost Include.
     
    cPanelMichael likes this.
Loading...

Share This Page