What I'm trying to acomplish is:
When trying to access:
www.example.com/fr/something
It should redirect to:
www.example.fr/fr/something
I have this is working with the following rules:
- Code: Select all
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteCond %{REQUEST_URI} /fr/
RewriteRule (.*) http://www.example.fr/$1 [R=301,L]
When trying to access:
www.example.fr/something
It should redirect to:
www.example.com/something
The rule that I have in place right now for this is:
- Code: Select all
RewriteCond %{HTTP_HOST} ^www.example.fr$
RewriteCond %{REQUEST_URI} !/fr/
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
With the second rewrite condition above I'm trying to say "when there isn't any country code subfolder it should redirect to the .com"
Any ideas anyone? I'm not too experienced with mod_rewrite or regular expressions so any feedback will be much appreciated.
Thanks.