Web Hosting, Design, & Coding forum

Question

blocking a website in certain country

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

hi,
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 -
Answer
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:
<Limit GET POST HEAD>
Order Allow,Deny
Allow from all
deny from 66.66.0.0/15
</Limit>

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 -
Answer
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
SetEnvIf GEOIP_COUNTRY_CODE US AllowCountry
SetEnvIf GEOIP_COUNTRY_CODE CA AllowCountry
Deny from all
Allow from env=AllowCountry
</IfModule>

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,
-Paul

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
icon
Computer Help 49,613 discussions
icon
Computer Newbies 10,349 discussions
icon
Laptops 19,436 discussions
icon
Security 30,426 discussions
icon
TVs & Home Theaters 20,308 discussions
icon
Windows 10 360 discussions
icon
Phones 15,802 discussions
icon
Windows 7 7,351 discussions
icon
Networking & Wireless 14,641 discussions

CNET's Tech Minute

Top 3 news reading apps

With the latest tech, getting news delivered to your phone is easier than ever. Here's a roundup of apps that are customizable and useful for getting the news.