Restricting Site Access
December 8, 2005 6:18 AM   Subscribe

Is there a way I can automatically restrict/deny access to my website from certain regions/locations (states/parts of states), possibly by redirection?

I am not looking for a password solution; it’s already one of those kinds of sites ;-)

For example, say I wanted anyone from Iowa (Just an example, I have nothing against Iowa) who tries to access my site to get automatically redirected to somewhere else, say Google, while everyone else just goes through.

I know I can restrict IP addresses through htaccess on an individual basis, but that’s not what I’m looking for either. I’m also not looking for putting something on my site that says “If you are from anywhere other than Iowa, click here to enter: Iowans or Iowites or Iowers, click here to exit”

You know those little messages that some people put in their sig lines and such that say something like “Hi, you are using Windows XP, your browser is Firefox, your IP address is 12.34.56.78 and you are located in Iowa.” I was thinking of something that looks at that same kind of information, but redirects the user when it sees Iowa in the location. But thats just me thinking out loud.

I know that this type of solution could be/would be gotten around by using a proxy, but I’m ok with that.

I was hoping there was something I could put in the code of my index page or something along those lines.

Free and paid solutions are both cool (but free solutions are cooler).
Bonus points for solutions that are more targeted than just states (say, Northwest Iowa or Des Moines)

Again, nothing against Iowa, its just 4 characters long and easier to type than say, Mississippi.

(Nothing against Mississippi, either!)
posted by sandra_s to Computers & Internet (13 answers total)
 
The name of what you are looking for is "geotargeting." As I think you understand, it is not 100% reliable. But lots of companies such as Google use it to focus their products/services to particular geographic regions.

MaxMind provides GeoIP databases, there are probably others.
posted by justkevin at 6:30 AM on December 8, 2005


BTW, they claim that within the US they have a 75% success rate of resolving an IP address within 25 miles of its true location. For what it's worth, they got mine right.
posted by justkevin at 6:36 AM on December 8, 2005


You can use the API or the downloadable database of HostIP to get the location information and adjust the content sent by your site accordingly.

There are similar services, both commercial and non-commercial. But AFAIK, the information is never entirely accurate. In my experience country information is mostly correct, cities often are not.
posted by uncle harold at 6:37 AM on December 8, 2005


City info doesn't work at all for AOL people.
posted by smackfu at 6:55 AM on December 8, 2005


May I just mention the fact that geotargeting can be SUPREMELY annoying? Take, for example, Showtime's website, located at sho.com. All I get is:

"We at Showtime Online express our apologies; however, these pages are intended for access only from within the United States."

Which makes me hate them with the fiery heat of a thousand suns.

(sorry for the derail. And yes, I know there are ways to getting around Showtime's staggering stupidity, but that's beside the point)
posted by slater at 6:57 AM on December 8, 2005


slater: it can be useful, though, to cover your ass when it comes to certain legal regulations... :)
posted by antifuse at 7:00 AM on December 8, 2005


GeoBytes offers a similar package to the ones discussed above. Still, it's nice to have more options, right?

Check how accurate they are for yourself.
posted by disillusioned at 7:45 AM on December 8, 2005


That Maxmind demo doesn't seem to work any better than other georeferencing tools I've used. I'm in Texas, and its result is 140 miles off. I wonder if it has the same trouble with AOL IPs, which seem to put all of them in Reston VA.
posted by rolypolyman at 8:08 AM on December 8, 2005


hmmm. GeoBytes puts me in La Serena, Chile (which is right), while Maxmind puts me in Tucson, AZ, apparently from the domain name (that being where the mother ship is located).
posted by andrew cooke at 8:33 AM on December 8, 2005


You have to understand that doing geolocation based on IP address is extremely unreliable. Especially if you are talking about the granularity of the state level, which is kind of a joke. I'd say the only thing you can expect to reliably predict would be the continent, but even then not always. There are lots of services that will sell you on being able to determine country, but be prepared for a TON of wrong data. State? I wouldn't bother, unless you're okay with probably about a 50% false positive rate.
posted by Rhomboid at 9:16 AM on December 8, 2005


I am *DYING* to know more about your site and why you're trying to restrict particular geographic access.
posted by radioamy at 10:52 AM on December 8, 2005


MaxMind: off by 5 counties
GeoBytes: off by 3 counties
HostIP: off by 4 counties
posted by nakedcodemonkey at 4:34 PM on December 8, 2005


radioamy writes "I am *DYING* to know more about your site and why you're trying to restrict particular geographic access."

See here
posted by Mitheral at 8:48 PM on August 29, 2006


« Older Good PC gaming websites?   |   FTP upload problems Newer »
This thread is closed to new comments.