Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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

2 Answers 2

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:

<Limit GET HEAD POST>
order allow,deny
Country: China
ISO Code: CN
allow from all
</Limit>
share|improve this answer

Your Answer

 
discard

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