This method will only work on Apache servers with mod_rewrite installed. There are ways to do it on some other servers but Apache is by far the most commonly used webserver so I will use it for this example.
If you already have an .htaccess file in your web root then edit the code below to suit your requirements and append it to the end of the file. If you don't have an .htaccess file then create a text file in the root of your web server and name it .htaccess.
Edit the "BadBot" part of each line to match the nuisance bots. Each entry must end with [OR] with the exception of the last one on the list as shown below.
Code:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^BadBot_1 [OR]
RewriteCond %{HTTP_USER_AGENT} ^BadBot_2 [OR]
RewriteCond %{HTTP_USER_AGENT} ^BadBot_3 [OR]
RewriteCond %{HTTP_USER_AGENT} ^BadBot_4
RewriteRule ^.* - [F,L]
If you need to block an actual IP or domain rather than the agent then you can use {REMOTE_ADDR} instead of {HTTP_USER_AGENT} and replace the bot name with an IP or domain.
Another way to block IPs and domains that doesn't require the use of Mod_Rewrite is to use the method described in this post.
http://www.eshopforums.com/f30/how-u...ur-website-91/ though it won't work with agent names.