Web Hosting, Design, & Coding forum


blocking a website in certain country

by VikeshU / February 12, 2012 4:17 PM PST

i have a website i want to stop this website being viewed in a certain country, i know its possible just dunno how to do that how to get the IP range of that country,,,

Discussion is locked
You are posting a reply to: blocking a website in certain country
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: blocking a website in certain country
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.

All Answers

Collapse -
RE: blocking a website in certain country
by FBFideas / February 14, 2012 10:28 PM PST

Hello VikeshU,
Here is list of country IPs: http://www.ipdeny.com/ipblocks/
You can block the desired ranges through .htaccess.
You can do this adding something like following:
Order Allow,Deny
Allow from all
deny from

Collapse -
Country Blocker Appliance
by doug_w / May 13, 2012 9:38 AM PDT

Creating so many iptables rules creates huge memory & CPU overhead loading rules for each new connection and causes latency issues.

For an on-premise appliance, I found an in-line appliance that works w/ other firewalls and routers to block IP addresses by country with no network latency as it operates as a layer 2 bridging appliance.

Ideal for SMBs in the US - why would I be open to attack by countries that don't bring any revenue into my business?

Collapse -
blocking websites
by thetoolsmith05 / April 1, 2012 11:25 PM PDT

I run a dating site similar to plenty of fish and faced the same issue. Here are a few options:

You can modify your .htaccess file to exclude certain countries like so:

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

It's not the ideal solution.

Another option is to use a GEOIP service and block the IP based on it's origin using a service like: http://www.maxmind.com/app/country

Hope that sheds some light,

Note: This post was edited by a forum moderator to remove unnecessary link to site on 04/02/2012 at 11:22 AM PT

Popular Forums
Computer Help 51,912 discussions
Computer Newbies 10,498 discussions
Laptops 20,411 discussions
Security 30,882 discussions
TVs & Home Theaters 21,253 discussions
Windows 10 1,672 discussions
Phones 16,494 discussions
Windows 7 7,855 discussions
Networking & Wireless 15,504 discussions


Want to see the future of car technology?

Brian Cooley found it for you at CES 2017 in Las Vegas and the North American International Auto Show in Detroit.