Mobile app version of vmapp.org
Login or Join
Reiling115

: When the HTTP site redirects to HTTPS what should the canonical URL tag point to? We have already 301 redirect from http://example.com to http://www.example.com and now we have redirect to https://www.example.com/

@Reiling115

Posted in: #CanonicalUrl #GoogleSearchConsole #RelCanonical

We have already 301 redirect from example.com to www.example.com and now we have redirect to www.example.com/
Now, the question is do we have to use the canonical i.e

<link rel="canonical" href="https://www.example.com" />


or

<link rel="canonical" href="http://www.example.com" />


Which one to choose and why?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Reiling115

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

The clue is in the name... whatever is the canonical URL should go in the rel="canonical" element.

The rel="canonial" element, as it's name suggests, contains a reference to the canonical URL. There can only be one canonical URL. Since you have implemented SSL and are redirecting everything to HTTPS then that is now your canonical URL and that is what goes in the rel="canonial" element. So...

<link rel="canonical" href="https://www.example.com/">


Btw, the hostname actually ends in a slash. And you don't need the self-closing slash in HTML (that's an XHTML hang over).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme