homepage Welcome to WebmasterWorld Guest from 54.235.16.159
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

    
Blocking IPs from a specific region
AngelX




msg:4173204
 6:47 am on Jul 20, 2010 (gmt 0)

Hey guys,

I was wondering if it was possible to block IPs from a specific US state (for example Iowa) from accessing my website.

I've searched on Google for ip blocking, but the results only seem to relate to blocking an entire country, not a specific state or region.

blockacountry.com is pretty much the exact thing I'm looking for, but again state specific. Something relatively simple and easy to implement.

Thank you for your time :)

 

lammert




msg:4173420
 3:58 pm on Jul 20, 2010 (gmt 0)

Hi AngelX, first of all Welcome to WebmasterWorld!

Many solutions which are available for country determination based on IP address are also available on state level. You should however know that the smaller the discrimination level you require, the larger the error will be. Especially with large ISPs like AOL which use a number of proxy servers to tunnel all client traffic through, it will be difficult to know exactly from which state a visitor is coming from.

If you have some knowledge in programming in for example PHP, a solution which uses a local IP database on your web server would be the simplest and fastest solution.

AngelX




msg:4173542
 6:36 pm on Jul 20, 2010 (gmt 0)

Hi lammert,

Thank you for your reply and welcoming to this forum.

I think I know what I need to do, but the problem is I have zero coding knowledge :(

I need to use this program (it's free) to generate the required state's IP list:

[maxmind.com...]

Then I could use it in the following format:

<Limit GET HEAD POST>
order allow,deny
deny from 60.254.128.0/18
deny from 163.60.0.0/16
deny from 192.103.43.0/24
allow from all
</LIMIT>

And just put the above in a .htaccess file on the root of the server.

If someone was willing to help me do this I'd be very grateful. Not to sound cheap but I could spare $20 for it too (would probably take someone with the know how a couple of minutes)

Thanks again

lammert




msg:4174489
 4:55 am on Jul 22, 2010 (gmt 0)

Hi AngelX,

WebmasterWorld tries to be not a place to hire others to do work for you. There are excellent freelancer sites for that and you'll get much better response there. Our focus is to try it ourselves, get our hands dirty and actually learn something from it :)

The .htaccess file is located in your root folder of your webserver. If you don't have such a file it's easy. Just create one with the exact content you need to block your specific area and upload that file to your server with FTP. If an .htaccess file already exists on your web space, you should first download that file to your local computer, add the block lines to the top of the file and then upload it again to your server.

In most cases using FTP is the easiest way to upload and download files on your web space, but if you use a content management system on your site, it is sometimes also possible to edit the .htaccess file directly within your browser environment.

poiuy




msg:4174524
 6:52 am on Jul 22, 2010 (gmt 0)

<Limit GET HEAD POST>
order allow,deny
deny from 60.254.128.0/18
deny from 163.60.0.0/16
deny from 192.103.43.0/24
allow from all
</LIMIT>

And just put the above in a .htaccess file on the root of the server.
It is available!

maximillianos




msg:4176127
 3:16 pm on Jul 25, 2010 (gmt 0)

We use a GEO database which we download for free every month (automated by a cron job). We can then block IP addresses based on country, which is helpful for reducing spam.

Works pretty well. We have so far found it to be 100% accurate from what we have sampled and reviewed.

Maurice




msg:4176531
 11:23 am on Jul 26, 2010 (gmt 0)

well as IP's are handed out on a country level and not a state, county, province level (IP is not like NANP or telecoms number schemes) - your probably not going to get a 100% accurate solution.

As people have said you can buy access to gelocation lists which you could use to block particular IP's

Id also block it at the exterior router if possible as using htacess will still put an additional load on your webserver.

Do you really need to do this? aren't there laws about interfering with interstate commerce in the USA?

lammert




msg:4178306
 2:26 am on Jul 29, 2010 (gmt 0)

There can be many legal reasons to block Internet access from specific states to your site, for example if you offer items on your site which are legal in one state, but illegal in another. Weapons, adult content, alcoholic beverages and gambling come to my mind as potential candidates for this kind of state level blocking.

Another more commercial reason can be if you have two websites, one targeting a single state, the other targeting the rest of the US. But in that case it might be a better solution to redirect visitors from the wrong state to an explanation page, or to the other site directly, rather than just blocking their access.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
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