Forum Moderators: phranque

Message Too Old, No Replies

AliasMatch vs. mod_rewrite

performance, virtualhost,

         

noox

10:24 am on Mar 6, 2005 (gmt 0)

10+ Year Member



I tried two possibilities to create search engine friendly urls.

In httpd.conf under VirtualHost:

RewriteEngine on
RewriteRules ^fd(.*)\.html /fd.php

or

AliasMatch ^/fd(.*)\.html /home/username/public_html/fd.php

It works in both ways. I do not neet to rewrite the parameters as I can get them from the server variables in fd.php.

Is AliasMatch easier for apache and therefore faster because mod_rewrite offers much more complexity?

Almost all pages from the concerning domain are called from the same directory. So I assume it's pretty indeifferent wether I put the rewrite rules or AliasMatch in the VirtualHost section or in a Directory section.

Thanks

sitz

3:43 am on Mar 7, 2005 (gmt 0)

10+ Year Member



The easy answer to this question is "benchmark them both yourself and see which is faster"; a program called 'ab' is installed with apache for doing benchmarking. It's generally not a good idea to run ab from the host which is running apache, since ab will be causing server load which wouldn't normally be there. I recommend running the benchmarks two hosts dedicated for the purpose, if at all possible; one running apache and one running ab. In a perfect world, you want both of the test hosts to be running nothing else, since any other load could corrupt the benchmark.

Note that if you don't use mod_rewrite for /anything/, you can comment it out of your httpd.conf completely which will result in a (very slight) increase in overall server performance.