0

Not sure I am posting at the right location :)

I want to be able for instance to redirect http://www. example.com (with www) to http:// example.com/fr (without www, AND subdirectory)

Of course, I also want http:// example.com to redirect to http:// example.com/fr

What I have so far is this :

RewriteBase / RewriteRule ^index\.php$ - [L] 
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ example.com/fr/$1 [L,R=301,NC]
RewriteCond %{HTTP_HOST} ^example.com [NC] 
RewriteRule ^(.*)$ example.com/fr/$1 [L,R=301,NC]

It does a permanent loop though... How can I fix this ?

Thank you ! :)

1 Answers1

0

What about this:

RewriteCond %{HTTP_HOST} ^(www\.)?example.com$ [NC]
RewriteCond %{REQUEST_URI} !^/fr/.*$
RewriteRule ^(.*)$ /fr/$1 [L,R=301,NC]