adamski99
07-20-2009, 09:17 PM
Hi All,
I'm at my wits end with this one. Never been strong with .htaccess and this one has me baffled.
I'm trying to achieve having a site that uses geoip to direct uses to country pages. Eg domain.com > domain.com/us/ or domain.com/eu/
This works fine to achieve that
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(DE|FR|GB)$
RewriteCond %{REQUEST_URI} !^/eu/
RewriteRule ^(.*)$ /eu/$1 [R,L]
Good.
Now I want to use one set of pages in the root that each virtual directory pulls and then the content will be dynamically generated.
This code works fine for that bit
RewriteRule ^eu/(.*)[/]?$ /$1 [NC,L]
What's the problem then? Well I can't get them working together because it goes into a loop. I understand why it goes into the loop but I can't figure out how to get round it. Can anyone point me in the right direction?
Total code in .htaccess in root
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(DE|FR|GB)$
RewriteCond %{REQUEST_URI} !^/eu/
RewriteRule ^(.*)$ /eu/$1 [R,L]
RewriteRule ^eu/(.*)[/]?$ /$1 [NC,L]
TIA
Adam :)
I'm at my wits end with this one. Never been strong with .htaccess and this one has me baffled.
I'm trying to achieve having a site that uses geoip to direct uses to country pages. Eg domain.com > domain.com/us/ or domain.com/eu/
This works fine to achieve that
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(DE|FR|GB)$
RewriteCond %{REQUEST_URI} !^/eu/
RewriteRule ^(.*)$ /eu/$1 [R,L]
Good.
Now I want to use one set of pages in the root that each virtual directory pulls and then the content will be dynamically generated.
This code works fine for that bit
RewriteRule ^eu/(.*)[/]?$ /$1 [NC,L]
What's the problem then? Well I can't get them working together because it goes into a loop. I understand why it goes into the loop but I can't figure out how to get round it. Can anyone point me in the right direction?
Total code in .htaccess in root
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(DE|FR|GB)$
RewriteCond %{REQUEST_URI} !^/eu/
RewriteRule ^(.*)$ /eu/$1 [R,L]
RewriteRule ^eu/(.*)[/]?$ /$1 [NC,L]
TIA
Adam :)