Yes, you can block visitors per their IP address. Countries will have a specific IP address range, and you can use that information to block all or some of their IP's. There are more than one way to do this:
Blocking a Country or Region using PHP
Searching the internet, we found a unique solution for blocking countries and regions via IP addresses with some PHP coding.
Visit http://azuliadesigns.com/block-website-access-country/ for more details about this method, including example code.
Blocking a Country or Region with htaccess Deny Rules
Another way to do it is to block IP ranges in the .htaccess file for your site.
Although it is possible to block an entire region or country using this method, it causes huge amounts of overhead for the Apache web server, due to the large number of htaccess rules that are added. This directly affects performance of your website and the server.
We therefore discourage use of this technique unless there are compelling reasons to do so, and if used, to limit the number of IPs blocked.
For a current list of IP addresses by country, please visit http://www.countryipblocks.net/
On the resulting page, click the ".htaccess deny" link for the desired country. This is the exact code you should paste in your .htaccess file.
Usually the .htaccess in your public_html folder is best, as it can protect all your addon domains and subdomains.
I have a specific IP I want to block.
If you already know the IP address you want to block, click here to read How do I deny access for a specific IP address?


