Web Hosting, Design, & Coding forum


blocking a website in certain country

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

In reply to: blocking a website in certain country

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

In reply to: RE: blocking a website in certain country

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

In reply to: blocking a website in certain country

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 Newbies 10,686 discussions
Computer Help 54,365 discussions
Laptops 21,181 discussions
Networking & Wireless 16,313 discussions
Phones 17,137 discussions
Security 31,287 discussions
TVs & Home Theaters 22,101 discussions
Windows 7 8,164 discussions
Windows 10 2,657 discussions


Sublime suburban chariot

High on style and technology, the 2019 Volvo XC90 is an incredibly satisfying everyday crossover.