Please Help Me Optimize This
Posted
by
Zero
on Server Fault
See other posts from Server Fault
or by Zero
Published on 2010-12-28T03:30:13Z
Indexed on
2010/12/28
3:56 UTC
Read the original article
Hit count: 140
I'm trying to optimize my .htaccess file to avoid performance issues.
In my .htaccess file I have something that looks like this:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} bigbadbot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} otherbot1 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} otherbot2 [NC]
RewriteRule ^.* - [F,L]
The first rewrite rule (bigbadbot) handles about 100 requests per second, whereas the other two rewrite rules below it only handle a few requests per hour.
My question is, since the first rewrite rule (bigbadbot) handles about 99% of the traffic would it be better to place these rules into two separate rulesets?
For example:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} bigbadbot [NC]
RewriteRule ^.* - [F,L]
RewriteCond %{HTTP_USER_AGENT} otherbot1 [NC,OR] RewriteCond %{HTTP_USER_AGENT} otherbot2 [NC] RewriteRule ^.* - [F,L]
Can someone tell me what would be better in terms of performance? Has anyone ever benchmarked this?
Thanks!
© Server Fault or respective owner