CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   Rewrite Rules - htaccess rewrite looping (http://www.codingforums.com/showthread.php?t=172309)

adamski99 07-20-2009 08:17 PM

Rewrite Rules - htaccess rewrite looping
 
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

Code:

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

Code:

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

Code:


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 :)


All times are GMT +1. The time now is 07:51 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.