Sunday, April 17, 2011

How to Block a Country by IP Address

Nov 1st, 2010 by JadeDragon
IP Addresses, the numbers that allow other computers to see where you are connected to the internet, can be very useful to geographically target your audience. Try logging into Google.com outside the USA and you will likely be redirected to a localized site like Google.ca (in Canada).
IP Addresses, the numbers that allow other computers to see where you are connected to the internet, can be very useful to geographically target your audience.  Try logging into Google.com outside the USA and you will likely be redirected to a localized site like Google.ca (in Canada).
For this blog readers come from all over the world, and I welcome that because the information on how to build passive or residual income generally works everywhere.  However, for many sites more local traffic is more useful.  If spammers are an issue on your site, and there is no advantage to granting access to all countries, you may want to block access to IP addresses in selected countries.  
The need to exclude China, Russia and some African countries from a coin forum I help run lead to this neat little tool -Block a Country.   With Block a Country, you give some basic info for access and are then presented with a long list of every country in the world (and a few non-countries too).  Select the countries you wish to block with the CTRL key and than hit go to get an IP list that can be uploaded into your server.  Here is how the site describes the process: 
Copy the information from the left textbox (a list of IP Address Ranges, plus a few lines of code) and past it into your .htaccess document. If you do not have a .htaccess document on your server you need to create one.
The easiest way to create an .htaccess document is to create a document in notepad and call it i.e. htaccess.txt. Past the blocking information into this the document. Following you upload htaccess.txt on to your server with your favorite FTP client. Once uploaded you rename the htaccess.txt document to .htaccess. (Note: take care that the dot is kept before htaccess).  
After completing these steps you can say Pakah to the Russian spammers and Zaijian to the Chinese spammers.  Good luck and enjoy the reduced spam.

Read more: http://www.bukisa.com/articles/385409_how-to-block-a-country-by-ip-address#ixzz1DYCp3vTs

1 comment:

  1. I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work.internship in jodhpur

    ReplyDelete