Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to block users from a particular region. Currently I have compiled a list of over 100 IP addresses that I block in my .htaccess file. Unfortunately as the list grows I see a great number of offenders come for the same areas, like China. Can I block that entire country? Or region?

share|improve this question

migrated from stackoverflow.com Feb 27 '11 at 14:12

This question came from our site for professional and enthusiast programmers.

Are you really prepared to firewall off a billion people because of 100 bad apples? – sarnold Feb 27 '11 at 6:18
Yep! They are not a part of my market but a few rotten tomatoes spoil the experience for my community here. And I'd like to add to it Korea too. – santa Feb 27 '11 at 6:19
Isn't this taking the naughty & nice thing a little bit too far? :-) – David Gelhar Feb 27 '11 at 6:21
Not sure what you mean. When you site with thousands of members goes blank for a few hours -- is it time to be nice? – santa Feb 27 '11 at 6:24

Use GeoMax lite to identify the country and block them. mod_geoip apache module can help you in what you want to do.

share|improve this answer

You can try this in the .htaccess file:

order allow,deny
Country: China
ISO Code: CN
allow from all
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.