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!