Block specific Visitors from visiting your site, Who try to Harm your reputation..!

Yes, you read it right. There will be always some people who will try to Harm your Reputation by posting abusive and spam comments in your blog.And The worst part may be clicking your Adsense ads or other ads and trying to get you Banned due to click fraud.Yes You can always use WordPress plugins to Stop Spam comments but if you want to Block certain visitors from a specific IP address this Htaccess trick will be useful.

Note : This trick is applicable for blogs On a self Hosted Platform (e.g Self Hosted WordPress or static websites) .Blogs that are Hosted on Free Hosting accounts like Blogger or WordPress.com won’t be able to use this trick as they Do not have access to their FTP.

How to Know the IP address of the Spam Commentator:

If you are Using WordPress then Log in to your dashboard and  go to the comments  panel. You will see the IP addresses of all Your commentators there.

If you are not using WordPress then you can check your server logs (like awstats)  to get a more detailed information about the Spam commentator. You can also Use StatCounter for finding the IP addresses but the server logs and WordPress data are more than sufficient.

How to Block The Spam Commentator from Visiting your blog:

Okay Once the IP is determined you are all set to  block the Spam commentator.Following are the steps involved :

1. Open Your FTP account using any of the  FTP programs and go to your Website’s Root directory.

2. You will see a .htaccess File in the root directory. Download that File into your computer. In some FTP programs by default the htaccess file is hidden so may have to enable showing of Hidden files.

3. Once you have the .htaccess file in your computer create a back up of that file so that you can restore  things if something goes wrong during the blocking process.

4. Open the .htaccess file in notepad for editing  and add the following lines anywhere at the end of all the content:

<Limit GET POST PUT>
order allow,deny
allow from all
deny from xx.xx.xx.xx
</Limit>

replace xx.xx.xx.xx with the IP address of the commentator that you have extracted from WordPress or from your server logs.

5. To block multiple IP addresses from Visiting your blog You can always add another line just below the deny from Line and add another IP address. Here is an example explaining that issue :

<Limit GET POST PUT>
order allow,deny
allow from all
deny from xx.xx.xx.xx
deny from yy.yy.yy.yy
deny from zz.zz.zz.zz
</Limit>

6. Save your new Htaccess file and upload it to your Root directory.

7. If your site goes down or something Silly Happens Then probably you had done something wrong. Restore the backup as you had created in step 3 and leave a Comment here so that we can look down into what problems you are having.

If all goes well you will not see any change reflected in your site but the commentator won’t be able to visit that site from that specific IP address. So If anyone is Posting Vulgar comments or click bombing your site  do not grant him access and permanently block him from harming your blog.

Did this Method worked for you ? Do you have any better Idea ? Do share with us in the comments! Happy Blogging!!

24 Responses to “Block specific Visitors from visiting your site, Who try to Harm your reputation..!”

Leave a Reply

IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

What is 3 + 7 ?
Please leave these two fields as-is: