homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque & physics

Webmaster General Forum

Blocking a city or a state in USA
How do you block a city from visiting your website?

 6:01 am on Dec 12, 2008 (gmt 0)

Is there a way to block visitors from a city, specifically Rockville, Maryland without affecting entire Maryland and USA? I mean only IP addresses coming from Rockville only. I know it can't be blocked 100% but at least i need to block them.

If so, how can this be done?



 6:09 am on Dec 12, 2008 (gmt 0)

OK, I think I'll have to block entire Maryland so how can I block Maryland ip addresses from visiting website?


 7:34 am on Dec 12, 2008 (gmt 0)

MaxMind has IP databases that can give you the country and city of origin for a given IP. They have free (geolite city) and paid (geoip city) versions, the latter is more accurate of course.
I use their free country database so I don't know whether the city version also provide the state. If not you should search that DB for all places in Maryland.


 10:56 am on Dec 12, 2008 (gmt 0)

I browsed in MaxMind website but I can't find any free country database to search for a list of IP addresses.


 11:17 am on Dec 12, 2008 (gmt 0)

Google: maxmind geolite country
or Google: maxmind geolite city
The first results should get you there and then you have several options for downloading the database, either in CSV format to store in e.g. a MySql database or in a binary format for which an API is provided.


 12:48 am on Dec 13, 2008 (gmt 0)

If you are trying to prevent a competitor from seeing your site they can still view it via Google's cache.


 12:58 am on Dec 13, 2008 (gmt 0)

User-from: 20847, 20848, 20849, 20850, 20851, 20852, 20853, 20857
Disallow: /

If only it were that simple, huh? :)


 2:39 pm on Dec 14, 2008 (gmt 0)

killua, curious to the intent... what's up?

Corey Bryant

 5:14 pm on Dec 14, 2008 (gmt 0)

Check to see if maybe there is a static IP number and maybe block that if needed. You can block certain IPs / Class C on IIS which might be effective.

Keep in mind though if the user has another provider - like AOL, you might not be able to block him effectively


 7:37 pm on Dec 14, 2008 (gmt 0)

they can still view it via Google's cache

Only if you've allowed Google to cache your site.


 3:16 am on Dec 15, 2008 (gmt 0)

Didn't know that it was this difficult. I have no experience in database MySql whatsoever.

The reason why I want to block Maryland only in USA is because there's a group of people there whom I don't want them to visit.

Anyway, I failed.


 12:18 am on Feb 22, 2009 (gmt 0)

You can refer to the following article for redirection using the IP2Location.


Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved