homepage Welcome to WebmasterWorld Guest from 23.22.29.137
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Preventing access from specific countries?
RonSolo




msg:3471246
 6:10 pm on Oct 7, 2007 (gmt 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

 

wilderness




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

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...]

RonSolo




msg:3471268
 6:41 pm on Oct 7, 2007 (gmt 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

wilderness




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

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.

jdMorgan




msg:3471791
 1:51 pm on Oct 8, 2007 (gmt 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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
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