Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14120 reviews 1680 hosting providers

Questions & Answers

Blocking a website from certain countries

Apr 13, 2012 by DinoGuy
hi,

I have e-commerce website that I want to block for some countries. I know this is possible but I don’t know how, I also need a list of the countries IPs. I would really appreciate it if someone can help

1 Answer

0 votes
Apr 13, 2012 by RalphK
this is the list of country IPs: http://www.ipdeny.com/ipblocks/

You can modify your .htaccess file to exclude certain countries;

<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /home/user/GeoIP.dat
SetEnvIf GEOIP_COUNTRY_CODE US AllowCountry
SetEnvIf GEOIP_COUNTRY_CODE CA AllowCountry
Deny from all
Allow from env=AllowCountry
</IfModule>