[BlueOnyx:10179] Re: Yup - there's an app for that!

Michael Stauber mstauber at blueonyx.it
Wed Apr 18 16:35:11 -05 2012


Hi Alan,

> Well, I tried this--copied and pasted Stephanie's code into my
> site1.include, making the necessary changes, and restarted httpd. I
> spent 2 bucks on that app so I could check, and it still works! My log
> doesn't show a referrer--wonder if the app has been modified?

I also couldn't get it to work. Perhaps something is missing?

I also tried some of the SetEnvIfNoCase examples from this URL:

http://www.askapache.com/htaccess/setenvif.html

But all in all none of the SetEnvIfNoCase lines seemed to trigger.

So then I went back to mod_rewrite and tried this instead:

# Get rid of bad bots:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} .*google.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*yahoo.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*bot.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*spider.* [OR]
RewriteCond %{HTTP_USER_AGENT} "^Black.Hole"
RewriteRule .* - [F]

That worked fine. It points the offending bots to the generic access denied 
page.

Alternatively: If you want to just redirect the bots to a different page, 
replace the last line with this:

RewriteRule ^(.*)$ http://go.away/

This also works in an .htaccess provided .htaccess usage is allowed for that 
Vsite.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list