Using .htaccess to Report Delivery Time
The question was whether the number of rewrite rules in .htaccess would have a significant impact on performance.
With the following set of rewrite rules:
Options +FollowSymLinks -Indexes
<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_value allow_call_time_pass_reference 0
</IfModule>
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^cms/index\.php/plain_admin$ http://domain.com/admin [R=3
01,L]
RewriteRule ^cms/index\.php/plain(.*) $1 [R=301,L]
RewriteRule ^media.* - [L]
RewriteRule ^custom.* - [L]
RewriteRule content/treemenu/? /index_treemenu.php [L]
RewriteRule ^var/[^/]+/cache/public/.* - [L]
RewriteRule ^var/storage/.* - [L]
RewriteRule ^var/[^/]+/storage/.* - [L]
RewriteRule ^var/cache/texttoimage/.* - [L]
RewriteRule ^var/[^/]+/cache/texttoimage/.* - [L]
RewriteRule ^design/[^/]+/(stylesheets|images|javascript)/.* - [L]
RewriteRule ^share/icons/.* - [L]
RewriteRule ^extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.* - [L]
RewriteRule ^packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^/favicon\.ico - [L]
RewriteRule ^/robots\.txt - [L]
# Uncomment the following lines when using popup style debug.
# RewriteRule ^/var/cache/debug\.html.* - [L]
# RewriteRule ^/var/[^/]+/cache/debug\.html.* - [L]
RewriteCond %{HTTP_HOST} ^webdav\..*
RewriteRule ^(.*) /webdav.php [L]
RewriteRule .* index.php
</IfModule>
The results were:
Received: t=1267660375832889 Duration: D=273652
Received: t=1267660761803171 Duration: D=297682
Received: t=1267660779066518 Duration: D=272959
Received: t=1267660804103095 Duration: D=292675
Received: t=1267660821137470 Duration: D=256268
This set of rewrite rules:
Options +FollowSymLinks -Indexes
<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_value allow_call_time_pass_reference 0
</IfModule>
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^media.* - [L]
RewriteRule ^custom.* - [L]
RewriteRule !(\.(gif|jpe?g?|png|css|swf|mp4|js|html?)|var(.+)storage.pdf(.+)\.pdf)$ index.php
</IfModule>
Yielded these results:
Received: t=1267660624947466 Duration: D=279933
Received: t=1267660660237894 Duration: D=289207
Received: t=1267660681578539 Duration: D=327192
Received: t=1267660701894745 Duration: D=254252
Received: t=1267660719493366 Duration: D=262131
This was a very informal test, just to see if there were any glaring differences, as you can see, the results were reasonably close.
Print article | This entry was posted by elvis on 03/03/10 at 06:15:38 pm . Follow any responses to this post through RSS 2.0. |