Forum Moderators: phranque

Message Too Old, No Replies

htaccess that blocks all non US networks

htaccess

         

sunchaser

7:04 pm on Jun 13, 2003 (gmt 0)

10+ Year Member



Has anyone ever seen or wrote an htaccess file that blocks all non US networks or have any advise on best-way to do it.

Netizen

7:33 pm on Jun 13, 2003 (gmt 0)

10+ Year Member



That could be one big .htaccess file. I am not an expert but I would have thought this was pretty impossible to do in a simple way. Whilst some class A and B addresses are exclusively US (say owned by a US ISP) I can't see this being a simple job. Class A is x.*.*.* Class B is x.y.*.* Class C is x.y.z.* - here [webopedia.com] is a good explanation.

Timotheos

8:46 pm on Jun 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another option is to use the php tools at ip-to-country.com

Netizen

8:52 pm on Jun 13, 2003 (gmt 0)

10+ Year Member



Or you can download their database (freely available) and do it yourself.

Key_Master

9:16 pm on Jun 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Consider using Language support in Apache [www-106.ibm.com] instead. You can ban non-english speaking people from your site. Not the same thing as IP blocking but much easier to implement. Browsers tell the server which language(s) they prefer. For example, my browser sends "en-us" for "English-United States" although many browsers simply send "en".

eaden

9:58 pm on Jun 13, 2003 (gmt 0)

10+ Year Member



1 ) download the ip-to-country database linked to on php.net
2 ) using that, generate a .htaccess

OR

3 ) Use php instead of .htaccess.