homepage Welcome to WebmasterWorld Guest from 54.204.141.129
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Syntax for Banning bots using httpd.conf
Imaster




msg:3384838
 8:37 am on Jul 3, 2007 (gmt 0)

Hello,

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>

 

jdMorgan




msg:3385681
 2:10 am on Jul 4, 2007 (gmt 0)

You can use any of the mod_setenvif directives; Some have more flexibility, some are easier to use. So the choice is a matter of need and personal style.

I assume this is the line that gave you problems:

BrowserMatch "^Download\ Demon" Getout

But that line should work fine. You could also try:

BrowserMatch ^Download\ Demon Getout

-or-

BrowserMatch "Download Demon" Getout

If neither works any better, then please tell us what is reported in your server error log -- The information logged there is often quite specific and useful.

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved