K
K
kizijo2017-08-25 22:37:04
Search Engine Optimization
kizijo, 2017-08-25 22:37:04

The canonical tag for the https and http versions of the site, how would it be correct?

There was a domin.com domain with:

<link rel="canonical" href="http://domain.com/" />
<link rel="alternate" media="only screen and (max-width: 640px)" href="http://m.domain.com/" />
<link rel="alternate" media="handheld" href="http://m.domian.com/" />

On its mobile version (m.domain.com), there is only one tag, like this: Now the site has started working in the same way using the https protocol. Hence the question, how now to correctly write these tags? The priority option is https, but there are no 301 redirects yet, while both versions are available. 1) Is it correct to make canonical for the http site on the https version? (judging by the Internet, yes) 2) But where will the https version refer in this case? To yourself? Or put canonical on the http version there? 3) What to do with alternate tags? Desktop http version should link to mobile http, and desktop https to mobile https? I will be glad for any hints.
<link rel="canonical" href="http://domain.com/" />

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Puma Thailand, 2017-08-26
@opium

write https make a redirect

B
Bogdan Gerasimenko, 2017-08-26
@Kleindberg

Try not specifying the protocol at all by changing to relative paths:

<link rel="canonical" href="//domain.com/" />
<link rel="alternate" media="only screen and (max-width: 640px)" href="//m.domain.com/" />
<link rel="alternate" media="handheld" href="//m.domian.com/" />

And in the .htaccess file, set up a forced redirect from http to https:
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

As my experience has shown, this will not affect the search results at all, the site will not fall out and Google will quickly pick up the new protocol.

Y
Yuri Popov, 2017-08-26
@DjPhoeniX

Just don't force an unconditional redirect to HTTPS. The correct way is HTTP Strict Transport Security and redirects in case Upgrade-Insecure-Requests is specified .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question