D
D
Den Belzarayn2017-04-13 18:11:18
Google
Den Belzarayn, 2017-04-13 18:11:18

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

Here is a picture illustrating the problem
b62a2167ef6b4029ad749feb226612ef.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-04-14
@shambler81

What's stopping you from adding exceptions to robot.txt ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question