Using a canonical tag
Published
Updated
⚔️
There can only be one.
A canonical tag in the HTML head names the preferred URL of a page that is reachable under several URLs or domains. Search engines index that URL.
Canonical tags
A canonical tag names the preferred URL of a page that is reachable under several URLs. Search engines then rank that URL and treat the others as duplicates. Add it to the <head> of every page:
<link rel="canonical" href="https://www.example.com/current-page" />
The href is the full URL of the page itself on the preferred domain, not the home page. Most CMS and SEO plugins generate the tag.
Canonical tag or redirect
With two domains serving the same content, such as example.com and example.net on one environment, both work:
- A redirect sends visitors and search engines to the preferred domain. Use it when the second domain needs no own visitors.
- A canonical tag keeps both domains reachable and only tells search engines which one to index.