View Single Post
Old 10-07-2007, 07:09 PM  
GrouchyAdmin
Now choke yourself!
 
GrouchyAdmin's Avatar
 
Industry Role:
Join Date: Apr 2006
Posts: 12,085
Jeez, processing an array for an IP's GeoIP country for all traffic is just about as wasteful as the freeloaders. It's a small enough list. Load the GeoIP DB and your banned list into SHM and just 403/redirect based upon that.

Actually, you could do that almost-natively with mod_geoip, now that I think about it.

Code:
<IfModule mod_geoip2.c>
  GeoIPEnable On
  GeoIPDBFile /usr/local/share/GeoIP.dat

  <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteCond !&#37;{ENV:GEOIP_COUNTRY_CODE} ^US$ [OR]
      RewriteCond !%{ENV:GEOIP_COUNTRY_CODE} ^CA$
      RewriteRule ^(.*)$ http://www.google.com$1 [L]
   </IfModule>
</IfModule>
Yeah, that should do it.
__________________

Last edited by GrouchyAdmin; 10-07-2007 at 07:11 PM.. Reason: Added code.
GrouchyAdmin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote