Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-20-2009, 08:17 PM   PM User | #1
adamski99
New to the CF scene

 
Join Date: Jul 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
adamski99 is an unknown quantity at this point
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
adamski99 is offline   Reply With Quote
Reply

Bookmarks

Tags
htaccess, rewrite rules

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:50 AM.


Advertisement
Log in to turn off these ads.