tags:

views:

35

answers:

2

i need to limit visits to my site from some regions. how can i don't allow to visit my site from some country?(from Armenia for example) (what is the way i must go? .htaccess? or maybe only by ip addresses?)

+3  A: 

You can utilize geolocation. http://www.geoplugin.com/webservices/php has a solid API which will give you a good set of information on a region based on the visitors IP address. Using this you can log access to a database and cut off regions after X amount of visitors or compare against a blacklist in a Database.

Be aware, proxying users may be inadvertantly blocked (I.e. China user routes via Armenia. Or US user through Turkey etc).

Additionally this works in reverse, if someone truly wants to visit your site they can proxy around.

CogitoErgoSum
A: 

IP addresses; .htaccess won't help you here. CogitoErgoSum nails the geolocation of IPs.

Dean J
Thanks for credit :)
CogitoErgoSum