Question

Block countries from accessing my website

Posted July 11, 2014 6.4k views

Hello. Can you help me block specific countries from accessing my website.

Thank you.

Sincerely,

Chris Anthony

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
3 answers

Why? What are you trying to accomplish by doing this? How are you going to determine the “country” of an IP? These questions can change the answer completely.

How detailed do you want the list. If you want to do mass blocking you could use https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xml

For instance if you want to block all APNIC (Asia Pacific ips) firewall off all the APNIC /8 entries.

http://www.ip2location.com/free/visitor-blocker lets you do it by country but that take a lot of time to compile a list unless you are targeting only a couple countries.

Of course they could always use a proxy to bypass this.

I recommend you setting up your website with Cloudflare, I believe that they have a feature that allows you to block certain countries from accessing your website.

Submit an Answer