Results 1 to 10 of 10

Thread: disable .htaccess

  1. #1
    bt4
    bt4 is offline
    Member
    Join Date
    Jul 2010
    Posts
    69

    Default disable .htaccess

    Hi,

    i want disable .htaccess for all hosts,
    if some upload or make new file name by .htaccess Automaticaly deleted or hided and get error 500 to this host
    i dont want it work on my server

  2. #2
    Member
    Join Date
    May 2006
    Location
    Johannesburg, South Africa
    Posts
    976
    cPanel/WHM Access Level

    Root Administrator

    Default Re: disable .htaccess

    You would probably need to write a custom script which runs via cron on a regular basis to find all .htaccess files and delete them

    But, bear in mind that you'll probably break many user's websites by doing this
    • cPanel :: Fantastico :: RVSkin :: WHM :: ModernBill
    • Reseller Hosting :: SSL Certificates :: Domain Registrations :: Affiliate Program
    • Blog Hosting :: CMS Hosting :: Forum Hosting :: E-Commerce Hosting

    SoftDux- The Leaders in Software
    Use the coupon: cpanel-06 to get 20% off our packages

  3. #3
    bt4
    bt4 is offline
    Member
    Join Date
    Jul 2010
    Posts
    69

    Default Re: disable .htaccess

    i dont want find htaccess from websites, if i delete them , hosts can make new one again, i want disable .htaccess

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: disable .htaccess

    Hello,

    You should have a section similar to the following:

    Code:
    <Directory "/">
    Options All
    AllowOverride All
    </Directory>
    Whatever it has listed for AllowOverride line, change to:

    Code:
    AllowOverride None
    At that point, then distill the changes, rebuild Apache and restart Apache:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak110802
    /usr/local/cpanel/bin/apache_conf_distiller --update
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    No further .htaccess files should work after this is set. It basically stops overrides at / level and higher using .htaccess files.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  5. #5
    bt4
    bt4 is offline
    Member
    Join Date
    Jul 2010
    Posts
    69

    Default Re: disable .htaccess

    thanks

    but how i can active htaccess just for one host or tow?

  6. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: disable .htaccess

    You cannot. It is one or the other.

    Also, your original request did not include this:

    i want disable .htaccess for all hosts,
    ...
    i dont want it work on my server
    It is probably possible to give another <Directory "/pathtodirectory"> option to allow AllowOverride, but I didn't test that option, since it wasn't what was asked.

    Edit: So, upon testing, this works:

    Code:
    <Directory "/">
        Options All
        AllowOverride None
    </Directory>
    
    <Directory "/home/username">
        Options All
        AllowOverride All
    </Directory>
    This would again need to be distilled, Apache rebuilt and Apache restarted. The username in the path would need to be revised to the actual cPanel username. At that point, the account in question can have an .htaccess file working.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  7. #7
    bt4
    bt4 is offline
    Member
    Join Date
    Jul 2010
    Posts
    69

    Default Re: disable .htaccess

    i test it, and working, before test it i have some problem, .htaccess showed from some host, and hided from some hosts some
    from some hosts when i make htaccess it get hided Automatically
    but from some host showed but ddt work
    what is the problem of that?
    from my friend server when some one upload .htaccess this Host Automaticaly get Error 500
    how he do that?

  8. #8
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: disable .htaccess

    Unfortunately, I am unclear on what is being asked this time. Please try to be clear with proper grammatical sentences on what is needed or being requested.

    The above method should be working for what was asked already. If this is not sufficient for reaching the goal required, when it does actually work to provide no .htaccess allowed for most accounts and allow some to use one, then I cannot really say why anything else is needed at this point.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  9. #9
    Member
    Join Date
    Aug 2011
    Posts
    4

    Default Re: disable .htaccess

    u can try this code to avoid such a problem

    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak110802
    /usr/local/cpanel/bin/apache_conf_distiller --update
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart

  10. #10
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: disable .htaccess

    I had already provided those same commands earlier when noting how to distill changes upon revising the AllowOverride section of httpd.conf file. I'm not certain if that was what was being asked by bt4
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. mod_security2 - how to disable it via .htaccess ?
    By WebHostDog in forum cPanel & WHM Discussions
    Replies: 5
    Last Post: 10-25-2007, 05:35 AM
  2. Disable cPanel's .htaccess abilities
    By tj111 in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 09-19-2007, 12:25 PM
  3. disable htaccess permanentely
    By jcorreia in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 04-05-2007, 02:22 AM
  4. .htaccess
    By SACHIN in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 12-16-2006, 03:45 AM
  5. .htaccess
    By vishal in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 07-19-2003, 03:04 PM