Forum Moderators: phranque

Message Too Old, No Replies

GeoIP country code redirect in .htaccess doesn't work

.htaccess Geo IP country redirection of website users

         

tony7444

11:07 pm on Mar 25, 2007 (gmt 0)

10+ Year Member



This is what I have in my .htaccess:

RewriteEngine On
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AT$ [NC,OR]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CH$ [NC,OR]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^DE$ [NC]
RewriteRule ^(.*)$ http://www.url.com/german/ [R,L]

I tried the trick with R=301, copied other redirects from forums, none of which worked. Am I missing something here? Do I have the wrong Apache version (1.3.33 - can't updated it, managed hosting)?

I tried it with external URL as well, still no redirecting, the root page loads normally (it's the same for overseas friends if I specify their geoip country code).

Any ideas?

jdMorgan

11:43 pm on Mar 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can we assume that you have installed the GeoIP module and have defined the required RewriteMap in httpd.conf?

Jim