Forum Moderators: phranque
RewriteCond %{HTTP_HOST} ^192\.168\.0\.0 [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com [OR,NC]
RewriteCond %{HTTP_HOST} ^example\.com\. [NC]
RewriteRule ^(.*)$ [example.com...] [R=permanent,L]
Be better written like this,
RewriteCond %{HTTP_HOST} ^192\.168\.0\.0¦www\.example\.com¦example\.com\. [NC]
RewriteRule ^(.*)$ [example.com...] [R=permanent,L]
Or the following,
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://example\.com/ [NC]
RewriteRule \.(gif¦jpg)$ - [F]
into this,
RewriteCond %{HTTP_REFERER} !^¦http://example\.com/^$ [NC]
RewriteRule \.(gif¦jpg)$ - [F]
Will it reduce overhead or will it be more overhead?
If there is no penalty, then I would probably want to combine some rules just to tidy up my htaccess file.
The general answer to your question is that combining conditions using the local OR "¦" is faster in .htaccess and slower in httpd.conf.
Member Andreas Friedrich benchmarked this for us a couple of years ago, and that thread may still be around here somewhere.
The reason is that mod_rewrite code in httpd.conf is compiled at server restart, while mod_rewrite code in .htaccess is interpreted for each HTTP request.
So --as usual-- the answer is "It depends." ;)
Jim