I am confused about adding canonical link in my website.

I have a website https://example.com and I have added Redirect to www from hosting provider(firebase) config.

So if a user accesses my non-www https://example.com, it will automatically redirect to https://www.example.com.

For the purpose of SEO I have added canonical link in header as follows

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

Is the above canonical link is correct?


The canonical is correct as long as there is only one and all URLs that access page show the same canonical. It is your choice as to which one but it is definitely best-practice that the canonical matches the redirect.

Remember that Googlebot also follows redirects, so if you have setup a Permanent Redirect, then there is only one visitable URL anyway. If you redirect to www.example.com without changing the protocol and you users are able to visit http://www.example.com and https://www.example.com then having the canonical is important but if all end up on the same URL, then the canonical is not really needed anyway.


Yes, this is canonical link is set correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.