Answer the question
In order to leave comments, you need to log in
How to setup .htaccess to redirect from old domain to new domain without www?
The problem is this.
In Firefox, this combination of rules causes the redirect to http:// www .new.rf, which doesn't work for me (for which there are two lines at the end).
In Chrome, from http:// (www)old.ru, it also redirects immediately to http:// new.rf, as required.
How to make a redirect from
1) http:// www.old.ru
2) http:// old.ru
3) http:// www.new.ru
redirect strictly to http:// new.ru for Firefox ?
Using punycode does not help in any way, I checked it.
RewriteCond %{HTTP_HOST} ^old\.ru$ [NC]
RewriteRule ^(.*)$ http://новый.рф/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
Answer the question
In order to leave comments, you need to log in
Found a solution through combining queries and using the OR operand.
Here it redirects immediately if the domain is old and through www, and if the old one is without www, and if the new one is through www.
I have not seen such solutions on the net, although in general everything is trite here.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old\.ru$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old\.ru$ [OR]
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://новый.рф/$1 [L,R=301]
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question