Become Wordpress Professional - Your Ultimate Wordpress Guide

Tuesday, 19 March 2013

How to Restrict Bad Bots from Accesssing Wordpress Site

wordpress bad bot restriction
In this tutorial you will learn how to protect your website against bad bots. You can also do this with WordPress plugins but there is a better and more efficient way to protect your site directory using the .htaccess file. Go to your Online Web Host Cpanel account and open .htaccess file and to implement this method. Copy the following code:

<IfModule mod_setenvif.c>
 SetEnvIfNoCase User-Agent ^$ keep_out
 SetEnvIfNoCase User-Agent (casper|cmsworldmap|diavol|dotbot)   keep_out
 SetEnvIfNoCase User-Agent (flicky|ia_archiver|jakarta|kmccrew) keep_out
 SetEnvIfNoCase User-Agent (libwww|planetwork|pycurl|skygrid)   keep_out
 SetEnvIfNoCase User-Agent (purebot|comodo|feedfinder) keep_out
  Order Allow,Deny
  Allow from all
  Deny from env=keep_out

After you have copied everything, return to your file editor and paste the code beneath any existing rules of your .htaccess file. This code is like a virtual control panel for blocking bad bots and user agents. This code first block blank user agents then the line number 4-6 collectively blocked some of the worst known bad bots. 

How to verify the Restricted code 

The last line number actually does the blocking based on a previous directive. Best of all upfront editing is required for more work. Just save the file. To see the code is working or not return to the browser and open this web

Add the URL of your website and clicking the Go button and as expected your site is accessible when using the legit user agent specified of the webpage. 

Now if you want to check if your WordPress site is restricted for bad bots, copy any of the listed bad bot like " skygrid " and return to the site paste in User agent box and then click go and you see the Forbidden error and it proved that request is blocked for this specified bad bots. 

This is exactly the response you want to send to bad bots and it is the simple response that easily pops up on the server.

Now you are able to restricted bad bots and user agents accessing your WordPress based website and using .htaccess instead of plugins. You are able to block bad bots directly with greater efficiency and better site performance.


Post a Comment

Please Avoid Spamming. Comments will be moderated before they are published.