Welcome to WebmasterWorld Guest from 35.172.195.49

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

how do I block countries and ip's form hitting my server?

     
1:36 pm on Mar 24, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 2, 2001
posts:597
votes: 0


there's 2 small sites on my server that are getting pounded by foreign traffic, and these site are not really for any market but the us. so, in hopes of lessening the load i was wondering -- how do I block all countries except the US for accessing these sites?

TIA!

1:19 am on Mar 26, 2006 (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


The only way to keep them from accessing your site is to ask your hosting provider to block them at the firewall.

You can use mod_access or mod_rewrite to forbid them from accessing content, but the requests will still show in your logs (and stats) with a 403-Forbidden response.

Blocking by IP address is simple. Blocking by 'country' is not at all straightforward, because IP addresses are not assigned by country, and because the assignments change constantly. Therefore, you'd need to sign up for a GeoIP service, and then use that to block access in httpd.conf or .htaccess (Read a lot on this subject before paying for it -- there are requirements for GeoIP that cannot be met on many inexpensive server accounts.)

Jim