Guys I have two different link but same website.
one of them is: https://example.com/
other is: https://www.example.com/
I am doing this process in a nodejs and pug. So I have a layout file which I have added my canonical link in order to effect every page of my website.
My canonical link (in Pug syntax):
link(rel="canonical", href="https://www.example.com/")
But I have added this link to my head
in my layout.pug
Why it is not redirecting to canonical url?
The "canonical" link
type does not redirect browsers to a different URL. Its purpose is to tell search engine spiders which variant of a page to index.