Not sure I am posting at the right location :)

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

Of course, I also want http:// to redirect to http://

What I have so far is this :

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

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

Thank you ! :)

marked as duplicate by Tero Kilkanen, HBruijn Nov 27 '16 at 8:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

What about this:

RewriteCond %{HTTP_HOST} ^(www\.)?$ [NC]
RewriteCond %{REQUEST_URI} !^/fr/.*$
RewriteRule ^(.*)$ /fr/$1 [L,R=301,NC]
  • 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 <title> nothing loads ever, Firefox keeps working but nothing appears. Any solution ? – Lisa Lucas Nov 28 '16 at 19:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.