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 [email protected]
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>
Apache won't need to look for a .htaccess file every time it accesses a file. The actual performance benefit will depend on,
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>
.