Deny traffic from most countries via GeoIP..is something wrong with this bit of code?

I’m trying to block any country outside of the US, CA, and MX, but when I add this code to my .htaccess, it blocks EVERYONE.



I tried first by continent, but it wasn’t blocking anything at all, no matter what I did, so I figured I’d switch and try it by country, but adding this just blocks everyone everywhere.



I’ve been on and off for the past two days with hostgator tech support to no avail. Anyone have any ideas?







SetEnvIf GEOIP_COUNTRY_CODE (US|CA|MX) AllowCountry





<Files *>

Order Deny,Allow

Deny from All

Allow from 127.0.0.1

Allow from env=AllowCountry

[

Did you try this?


[quote]GeoIPEnable On

GeoIPDBFile /path/to/GeoIP.dat



SetEnvIf GEOIP_COUNTRY_CODE US AllowCountry

SetEnvIf GEOIP_COUNTRY_CODE CA AllowCountry

SetEnvIf GEOIP_COUNTRY_CODE MX AllowCountry

… place more countries here


Deny from all
Allow from env=AllowCountry

# Optional - use if you want to allow a specific IP address from the country you denied
# (See [URL]http://httpd.apache.org/docs/1.3/mod/mod_access.html[/URL] for more details)
Allow from 10.1.2.3[/quote]

Source [url]http://www.maxmind.com/app/mod_geoip[/url]

[quote name=‘indy0077’]Did you try this?







Source [url]http://www.maxmind.com/app/mod_geoip[/url][/QUOTE]





Thanks,



I’ll definitely give that a try, and let you know, I’m at my wits end trying to get it to work :wink: