Forum Moderators: DixonJones

Message Too Old, No Replies

blocking a country in htaaccess

blocking a country in htaaccess

         

pzwag

4:06 am on Sep 15, 2004 (gmt 0)

10+ Year Member



How can i block all say australians from a web site.
I dont know how to find out all ip address's for the country.
how do ai block out a range of ip address
ie 139.1 to 139.3

upside

6:32 am on Sep 15, 2004 (gmt 0)

10+ Year Member



There is no foolproof mechanism to block an entire country in htaccess. Countries will often have more than one ISP, each having multiple blocks of IP's. IP assignments change so any list of IP's would have to be updated often. There is, however, an Apache module called mod_geoip that can be used in conjunction with mod_rewrite to block users by country.

pzwag

11:08 pm on Sep 15, 2004 (gmt 0)

10+ Year Member



thanks for the reply
im not sure to to impliment your recommendations,
though it sounds like the best idea
i was hoping to do a filter on *.au
worst case I can find all the .au ip address

I still dotn know how to filter out the range of ip
ie 139.1 to 130.5

my solution doesnt need to be bullet proof, just
lock out the majority of country ip's i dont want

encyclo

12:15 am on Sep 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com], pzwag.

To deny access from certain IP addresses or hostnames, you can use allow and deny directives in your .htaccess file. This page from the Apache manual explains it well:

[httpd.apache.org...]

upside

2:32 am on Sep 16, 2004 (gmt 0)

10+ Year Member



It is not practical to list all of Australia's IP's because they have 6,615,910 as of today.

Harry

4:52 pm on Sep 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



He probably used Australia instead of another country to avoid insulting anyone. Everybody knows that Australians are desirable customers! ;)