Answer the question
In order to leave comments, you need to log in
How to redirect a site without changing the protocol to www?
Hello.
Please tell me, who knows what rules to prescribe in htaccess so that a redirect occurs from a site without www to www without changing the protocol, i.e.
ht tps://site_name.ru >>>>> ht tps://www.site_name.ru ht tp:
//site_name.ru
>>>>> ht tp://www.site_name.ru
there were no more redirects.
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Well, for example.
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP_HOST} !^www\.(.*) [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} !^www\.(.*) [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question