Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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>
    ServerAdmin www@shop.co.uk
    ServerName shop.co.uk
    ServerAlias www.shop.co.uk
    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
        </FilesMatch>

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

    <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
    </Directory>

    ErrorLog /var/log/apache2/shop-error.log
    LogLevel warn
    CustomLog /var/log/apache2/shop-access.log combined
</VirtualHost>
share|improve this question

1 Answer 1

up vote 9 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
3  
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 joedog.org/index/siege-home –  weeheavy Sep 12 '11 at 14:11

Your Answer

 
discard

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.