I have a website that I do not want to be viewed by entire countries. The website is running on a LAMP server. How can I achieve this?
feedback
|
migrated from stackoverflow.com Aug 18 '09 at 10:50
This question came from our site for professional and enthusiast programmers.
|
Use mod_geoip module. http://www.maxmind.com/app/mod%5Fgeoip For example:
| ||||
|
feedback
|
|
For IIS, you can install the ISAPI product to perform filter by country. http://www.ip2location.com/ip2location-isapi-filter.aspx You can use the database subscription from IP2Locationlcom for Apache as wel.. | |||
|
feedback
|
|
You can use rewrite_mod's REMOTE_ADDR condition to redirect banned users to a single page describing the fact that they are not allowed to enter, or simply give them a 403 error.
To get the range of IPs for a country, get the Maxmind database for example. | |||||
feedback
|
|
Check the IP and determine which country hosts it, and then block it. Of course it's not accurate, but it's something. Generally I'm not a fan of doing this though; but maybe it's required for some legal reason. | |||
|
feedback
|
|
You can filter the country ISP's ip adresses. There are a lot of geolocation database, to help you to identify the users country by ip. | |||
|
feedback
|
|
I have came across this site, which claims to ban country, IMO, the best way it to block using the .htaccess file | |||
|
feedback
|
|
You can use services like this: http://www.maxmind.com/app/geolitecountry to extract info which IP ranges belong to which countries and block them. Keep in mind if you block too many ranges on a high traffic web site you may see some heavy utilisation on your firewalls. | |||
|
feedback
|