How to allow only specific directories to use htaccess?

Posted by DisgruntledGoat on Server Fault See other posts from Server Fault or by DisgruntledGoat
Published on 2011-02-20T23:18:56Z Indexed on 2011/02/20 23:26 UTC
Read the original article Hit count: 168

Currently in apache2.conf I have AllowOverride all set for /var/www which simply allows htaccess for all the sites on the server (which is Ubuntu, 9.04).

However, I'd rather only allow overrides in each site root directory and nothing else. In other words, /var/www/site1, /var/www/site2, etc. can have a htaccess, but all other directories including /var/www and /var/www/site1/content cannot.

Is there a way to do this without having to write a rule for every site on the server?

© Server Fault or respective owner

Related posts about apache

Related posts about .htaccess