Reputation: 11
I think it should be possible to write most domain name redirects in one line, can you tell me if you think this is correct?
RewriteCond %{HTTP_HOST} ^(www\.myexample\.fr|myexample\.fr|www\.myexample\.com|myexample\.com)$
RewriteRule ^(.*)$ http://www.my-example.com/$1 [L,R=301]
I can't test as I can't afford the website to crash, even for one minute, too many people are working on it.
Thank you, i'm impatient to read your comments
Upvotes: 1
Views: 47
Reputation: 786091
You can simplify the conditions like this
RewriteCond %{HTTP_HOST} !=www.my-example.com
RewriteRule ^(.*)$ http://www.my-example.com/$1 [L,R=301]
i.e. is host is not www.my-example.com
in request then redirect to www.my-example.com
.
Upvotes: 2