G
G
glem13372018-12-27 18:41:45
htaccess
glem1337, 2018-12-27 18:41:45

Whether it is possible at once both on https, and on www in one rule?

There is a site https://www.site.com
When you go to site.com , 2 redirects are performed. First to https://site.com, and then to https://www.site.com
I consider this behavior to be logical, because first there is a redirect to https , and then to www , but the seo-specialist said that this he does not like. Googling this question everywhere I came across solutions http-> https-> https://www , that is, how it works at the moment.
Is it possible to make it so that when going to site.com , a redirect would be performed immediately to https://www.site.com , or is this the imagination of an seo specialist?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Marat Garifullin, 2018-12-27
@magarif

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.site.ru$ [NC,OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.site.ru$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question