Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Will turning off override by htaccess in apache have a performance increase? I have had a look online and there is very little articles/reports on this.

If this is the case how do I go about turning this off? Will I do this in the default virtual host file?

A example being: OpenCart comes with 2 htaccess files mainly for mod_rewrite, if I move this into a <Directory> will this make a difference?

<VirtualHost *:80>
    DocumentRoot /var/www/shop/public

    <Directory /var/www/shop/public>
        Options +FollowSymlinks

        # Prevent Direct Access to files
        <FilesMatch "\.(tpl|ini|log)">
         Order deny,allow
         Deny from all

        RewriteEngine On
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

    <Directory /var/www/shop/public/admin/view/javascript/ckeditor>
        AddType application/x-javascript .js
        AddType text/css .css

        # If PHP is mapped to handle XML files, you could have some issues. The following will disable it.
        AddType text/xml .xml

    ErrorLog /var/log/apache2/shop-error.log
    LogLevel warn
    CustomLog /var/log/apache2/shop-access.log combined
share|improve this question
up vote 10 down vote accepted

Apache won't need to look for a .htaccess file every time it accesses a file. The actual performance benefit will depend on,

  1. traffic to your site
  2. site layout
  3. server profile

I suggest you baseline the existing performance, using a web stress tool such as Apache's ab, make the change, re-profile, and see how much impact it has.

As to your second question, yes, I believe you would move the .htaccess stuff into <Directory> sections in your <VirtualHost>.

share|improve this answer
Another thing to note is it'll search every parent directory for an .htaccess file - deeper directories mean more checks (on every request). AllowOverride None to disable completely. – Shane Madden Sep 10 '11 at 20:21
As an alternative to ab you might use – weeheavy Sep 12 '11 at 14:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.