Answer the question
In order to leave comments, you need to log in
The problem of htaccess and a redirect to https, how to solve?
The situation is as follows, the redirect is registered and performs everything that is needed.
Redirects from the following urls: site.com, www.site.com, http//:site.com, https//:www.site.com to https//:site.com
But the situation is as follows, when checking in Google "site :mysite.com" gives its address at three urls: site.com, www.site.com/, and https//:site.com, only the last one needs to be.
htaccess used the following code
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question