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 AllowOveride None to Home Directories

Discussion in 'EasyApache' started by ItsMattSon, Nov 8, 2016.

  1. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    140
    Likes Received:
    29
    Trophy Points:
    28
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Hi guys,

    As I understand it, this directive below (in httpd.conf) allows .htaccess in root directory and below - so everywhere?

    <Directory "/">
    AllowOverride All
    Options FollowSymLinks Indexes SymLinksIfOwnerMatch
    </Directory>

    That was already like that so I presume it's a default but I'd like to disable .htaccess for users unless explicitly allowed.

    To do it, I believe I need to make a new directory block with "/home/user" and set AllowOverride to None. But where? :p

    The Documentation for Advanced Apache Configuration has been quite helpful, so if I put it in httpd.conf and distiller the file it could work, right? But *should* it instead go in one of the Include Editor field in WHM? And if so, which one is the appropriate one?

    Apologise for the beginner question. I sift through a fair few related threads before I hassle you guys with another one.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You can take the the following steps modify the entry:

    1. Copy the Apache 2.4 template for EasyApache 4 to allow for customization:

    Code:
    cp -a /var/cpanel/templates/apache2_4/ea4_main.default /var/cpanel/templates/apache2_4/ea4_main.local
    2. Edit /var/cpanel/templates/apache2_4/ea4_main.local to change the AllowOverride entry to none:

    Code:
    vi /var/cpanel/templates/apache2_4/ea4_main.local
    3. Save the changes, and then run:

    Code:
    /scripts/rebuildhttpdconf
    Let us know if this helps.

    Thank you.
     
  3. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    140
    Likes Received:
    29
    Trophy Points:
    28
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Hi @cPanelMichael,

    The solution looked promising, but upon editing ea4_main.local and rebuilding httpd conf (definitely has changed in /usr/local/apache/conf/httpd.conf), I can still use .htaccess files in my user accounts. Shouldn't the below have disabled that?

    <Directory "/">
    AllowOverride None
    Options FollowSymLinks Indexes SymLinksIfOwnerMatch
    </Directory>
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you let us know the specific entries in your .htaccess files that are still working? Are you attempting to disable .htaccess usage completely? If so, you'd have to add an additional line under "AllowOverride None" for "AllowOverrideList". For example:

    Code:
    AllowOverrideList Redirect RedirectMatch
    The Apache documentation explains how this works at:

    core - Apache HTTP Server Version 2.4

    Thanks!
     
  5. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    140
    Likes Received:
    29
    Trophy Points:
    28
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Hi Michael,

    I just set "Options Includes" in .htaccess in /home/user/public_html and put an local_date SSI in my index and it showed up. Without it in htaccess though, it's disabled by default thanks to your help in another thread (unticked it in the WHM's Apache Configuration).

    I thought that AllowOverride None would prevent any overrides?

    Theoretically, I shouldn't have to completely disable .htaccess with AllowOverrideList, should I?
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Please post the output from:

    Code:
    grep AllowOverride /var/cpanel/templates/apache2_4/*
    grep AllowOverride /usr/local/apache/conf/includes/*
    Thank you.
     
  7. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    140
    Likes Received:
    29
    Trophy Points:
    28
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Thanks for replying, Michael. Here's a screenshot of the output:
     

    Attached Files:

  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Could you open a support ticket using the link in my signature so we can take a closer look and determine why it's not working? You can post the ticket number here and I'll update this thread with the outcome.

    Thank you.
     
  9. ItsMattSon

    ItsMattSon Well-Known Member

    Joined:
    Sep 5, 2016
    Messages:
    140
    Likes Received:
    29
    Trophy Points:
    28
    Location:
    Perth
    cPanel Access Level:
    Root Administrator
    Hi @cPanelMichael,

    All sorted!

    I believe there must have been some failure in the rebuilding of the conf file (maybe on my part, not sure). The good news is that I can't seem to replicate the error anymore as of today (I hadn't actually tried since 11th Nov when I first posted the odd behavior in this thread).

    I can only assume that it was fixed when the upcp cron ran between then and now (which it does every night).

    Thanks very much for the help as always!
     
    cPanelMichael likes this.
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I'm happy to see the issue is now resolved. It's working as intended on a test system as well, but feel free to let us know if you encounter any additional issues related to this topic.

    Thanks!
     
    ItsMattSon likes this.
Loading...

Share This Page