Difference between Apache rules to block libwww-perl [closed]
开发者_开发百科
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this questionI 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!
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.
精彩评论