Welcome to WebmasterWorld Guest from 23.20.110.176

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Preventing access from specific countries?

     
6:10 pm on Oct 7, 2007 (gmt 0)

Junior Member

5+ Year Member

joined:June 11, 2007
posts: 45
votes: 0


How can I prevent specific countries (for example, Ghana in Africa) from accessing our website? What exactly do I enter into our .htaccess file?

Thank you,
Ron

6:29 pm on Oct 7, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member wilderness is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 11, 2001
posts:5459
votes: 3


go to ARIN and do a search on "African Network Information Center" and IP ranges provided will at least give you a beginning of what ranges to deny.

as to creating an htaccess file?
Some old threads:
[webmasterworld.com...]
[webmasterworld.com...]
[webmasterworld.com...]

Some tutorials/guides for htaccess:
[baremetal.com...]
[evolt.org...]
[edginet.org...]
[javascriptkit.com...]
[serverwatch.com...]
[brainstormsandraves.com...]
[the-art-of-web.com...]

6:41 pm on Oct 7, 2007 (gmt 0)

Junior Member

5+ Year Member

joined:June 11, 2007
posts: 45
votes: 0


Wilderness,
Thanks very much for the information and links!

BTW...is using the .htaccess file the only efficient way to deny access to countries or malicious visitors? Is there a better method?

Thanks,
Ron

7:52 pm on Oct 7, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member wilderness is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 11, 2001
posts:5459
votes: 3


htaccess the only way that I'm aware of on a "hosted" website.

If you have your own server, http.conf is more appropiate.

My widegts are exclusive to North America and I have most every non-NA range denied, however that was accomplished gradually and the providing the ranges to another would not be possible.

There are some websites, which you may go to an download entire ranges for specific countries, however these numbers change frequently.
Even with the files downloaded, your still faced with the tedious process of converting the IP ranges to rewrites.

1:51 pm on Oct 8, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Note that many of those same "IP range sites" also offer paid services. These services track the ever-changing map of IP addresses to countries, and provide you with updated data.

Many provide two kinds of service; One where your server makes a call to their server to check a requesting IP address, and another where you periodically download updates from their database to your server, and all checking occurs locally on your server (which is *much* faster). Do a search for "GeoIP" to turn up more info.

Jim