Difference between Apache rules to block libwww-perl

1.8k views Asked by At

I want to know the difference between these rules and which is most effective to block libwww-perl with the file .htaccess

SetEnvIfNoCase User-Agent "libwww-perl" bad_bot
Order Deny,Allow
Deny from env=bad_bot

or

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* – [F,L]

Thank you!

1

There are 1 answers

0
Smingos On

Functionally, I think they are much the same, with some minor pros and cons. However the former is probably more portable, since you won't have worry about mod_rewrite being installed on the server should you move the site at some point in the future.

Naturally, if you have other mod_rewrite rules this won't make much difference to you.

You also have a wildcard set up in the mod_rewrite rule, that isn't present in SetEnvIfNoCase. I understand this is possible to do this there also, and it might be wise to do so, since you can then catch different libwww versions.

I'm sure you know libwww-perl can send an arbitrary user agent string, so neither will stop the determined.