Forum Moderators: phranque
I am trying to ban all the bad bots from all websites on my server by using httpd.conf
I checked out one thread [webmasterworld.com...] which mentions using "BrowserMatch"
My question was should I use :
#BrowserMatch or
#browsermatchNoCase or
# SetEnvIf or
# SetEnvIfNoCase
Which one of the above should I use?
Additionally, I checked up the post "a close to perfect .htaccess file" which mentions using the following syntax types in .htaccess:
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]
So for a 2 word spider I used ^Download\ Demon , but that is giving error in httpd.conf. Should something else be used?
browsermatch "^DISCo" Getout
BrowserMatch "^Download\ Demon" Getout
#
<Files *>
Order Deny,Allow
Deny from env=Getout
Allow from all
</Files>
I assume this is the line that gave you problems:
BrowserMatch "^Download\ Demon" Getout
BrowserMatch ^Download\ Demon Getout
BrowserMatch "Download Demon" Getout
You may already know this, but just in case: "^" is a regular expressions start-anchor. If it is used, the pattern will match only if the user-agent starts with the specified string. See the regular-expressions tutorial cited in our forum charter if you need more info.
Jim