Why should you avoid .htaccess files
June 26th, 2008In order to make Apache .htaccess work on your servers you also need to add the AllowOverride directive inside
The first of these is performance. When AllowOverride is set to allow the use of .htaccess files, Apache will look in every directory for .htaccess files. Thus, permitting .htaccess files causes a performance hit, whether or not you actually even use them! Also, the .htaccess file is loaded every time a document is requested.
If you are running a big site and you are concern about performance then you should start by removing .htaccess files and moving them to your config director.
Most distributions have a directory from which any file that ends with .conf gets included when you restart Apache (Example RedHat/Fedora/Centos: /etc/httpd/conf.d).
The second consideration is one of security. You are permitting users to modify server configuration, which may result in changes over which you have no control. Carefully consider whether you want to give your users this privilege. Note also that giving users less privileges than they need will lead to additional technical support requests. Make sure you clearly tell your users what level of privileges you have given them. Specifying exactly what you have set
AllowOverrideto, and pointing them to the relevant documentation, will save yourself a lot of confusion later.
You can find all this info at the Apache website as well. Is worth reading it.


June 26th, 2008 at 11:18 pm
The .htaccess file will only be read once, it will be cached for later usage.
June 27th, 2008 at 1:45 am
Hi Dennis, I checked the apache sites and couldn’t find anything that talked about .htaccess files being cached for later usage. Instead they explicitly recommend against using .htaccess files because of performance issues. Pls send a URL.
June 27th, 2008 at 8:55 am
Linux caches all used files, it will be replaced when needed. If a file is used very often it will never leave the cache.
I don’t have a link sorry. It’s just normal Linux Memory Management and the method is called disk cache.
June 27th, 2008 at 8:56 am
Found a FAQ;
http://gentoo-wiki.com/FAQ_Linux_Memory_Management
July 30th, 2008 at 5:38 pm
Interesting, & the performance issue makes sense as Apache will have to read one or more extra files. Although if I’m running a data-driven LAMP site, would .htaccess files really make a significant performance impact, or are we talking like .02% difference?
August 3rd, 2008 at 3:52 pm
[...] should you avoid .htaccess file2 reasons, performance and security.http://www.chrisdevbox.com/blog/2008/06/26/why-should-you-avoid-htaccess-files/Whitehaven NewsWeekly newspaper for the Copeland region of West Cumbria, Whitehaven, Egremont, [...]