[KLUG Members] Blocking By User Agent
Ron Sweeney
ron.sweeney at gmail.com
Thu Nov 24 10:38:29 EST 2005
I used the following article while trying to hookup my .htaccess for Ruby on
Rails to do just that. Instead of using a Rewrite (which is extremely
flexible, but a little complicated) it involves setting an environment
variable, and then setting up a deny based on that variable:
# Known mail harvesters
SetEnvIf User-Agent EmailCollector BAD_BOT
SetEnvIf User-Agent CherryPicker BAD_BOT
# Code Red and Nimda
SetEnvIf Request_URI ^/default.ida BAD_BOT=worm
SetEnvIf Request_URI root.exe BAD_BOT=worm
# Referrer spam
SetEnvIfNoCase Referer ^http://(www.)?xopy.com BAD_BOT=spammer
SetEnvIfNoCase Referer ^http://(www.)?aizzo.com BAD_BOT=spammer
# Bad bot, no cookie!
Order Allow,Deny
Allow from all
Deny from env=BAD_BOT
http://www.trilithium.com/johan/2005/01/no-rewrite-required/
On 11/24/05, Adam Tauno Williams <awilliam at whitemice.org> wrote:
>
> Does anyone have any mod_rewrite rules for Apache that redirect based on
> the user-agent strings? I'd like to match the user-agent and not matter
> what the URL requested send them to a blank page. I see lots of user
> agents like ""msnbot/1.0","KavamRingCrawler", and "RufusBot". Since I
> am operating the site on somewhat limited bandwidth I'd just like to can
> these requests.
>
> _______________________________________________
> Members mailing list
> Members at kalamazoolinux.org
>
>
--
Ron Sweeney
http://www.gr-ruby.org
http://www.modelm.org
http://sweeney.modelm.org
http://www.clubpacswestmi.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.kalamazoolinux.org/pipermail/members/attachments/20051124/81ac64c3/attachment.html
More information about the Members
mailing list