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]
Diego Roccia
  • 348
  • 1
  • 6
  • Thank you. Don't forget to accept the answer and upvote :) – Diego Roccia Nov 25 '16 at 20:40
  • Well I think I've spoken too fast. It slows down like crazy the load speed of my website... :( Actually apart from the nothing loads ever, Firefox keeps working but nothing appears. Any solution ? – Lisa Lucas Nov 28 '16 at 19:42