What is a Canonical URL?
A canonical URL is the URL that Google sees as the “master” version of a set of duplicate or near-duplicate pages. Think of it as the difference between an original piece of art and its copies or prints. This canonical URL is what Google will index and potentially return to users in Google search.
Why are Canonical URLs Important?
Canonical URLs are important because Google will only index canonical URLs. This means that if you have duplicate content on your website, such as pages that are near or exact duplicates of each other, Google will only index one of them (the canonical).
If you set your canonical URLs properly, Google is likely to respect your decision and view that page as canonical. However, in the absence of a specified canonical for exact or near-duplicate pages, Google will use its best judgment to choose a canonical for you. This may not always be the URL you want Google to choose.
How to Set a Canonical URL
Google looks at several signals to determine the canonical URL for a set of duplicate or near-duplicate pages, one of which is the canonical tag. The canonical tag is a piece of HTML code that you add to the <head>
section of a page to specify the canonical version of that page. It looks like this:
<link rel="canonical" href="https://example.com/canonical-page/" />
Example
Suppose you own an ecommerce store where visitors can filter products by parameters like style, size, and color. This typically results in parameterized URLs with virtually identical content to your “master page”:
yourstore.com/tshirts
(master page listing all T-shirts)yourstore.com/tshirts?size=small
(identical to the master page but filtered for small T-shirts only)yourstore.com/tshirts?color=red
(identical to the master page but filtered for red T-shirts only)
Without proper canonicalization, you may end up in a situation where Google chooses to index the wrong version of the page or all of them. To ensure Google indexes the correct page, you can set the canonical version of these URLs by using a canonical tag on the master page, pointing to the master version without the URL parameters.
Best Practices for Canonical URLs
1. Use Self-Referencing Canonical Tags
Self-referencing canonical tags are canonical tags on a page that point to itself. For example:
<link rel="canonical" href="/blog/what-is-a-canonical-url/" />
Using self-referential canonical tags is recommended by Google’s John Mueller, as it clarifies which page you want to have indexed.
2. Use Absolute URLs
Absolute URLs contain all the information necessary to locate a resource and help avoid unintentional mistakes or misinterpretations of canonical URLs by search engines. Although relative URLs can be used, it is best SEO practice to use absolute URLs in canonical tags.
3. Exclude Non-Canonical URLs from Your Sitemap
Google advises against listing non-canonical URLs in your sitemap because it sees these URLs as suggested canonicals. To check for non-canonical URLs in your sitemap, you can use tools like Ranktracker's Web Audit.
4. Don’t Set 404s as Canonical URLs
A 404 status code indicates that a page cannot be found. You should avoid specifying a 404 page as canonical. Over time, pages may be removed or relocated, so it’s important to monitor and update canonical tags to ensure they point to live pages.
FAQs
Should I Canonicalize Paginated Pages to the Root Page?
For paginated pages, such as a series of blog archive pages, each page should use self-referencing canonical tags rather than pointing to the first page in the series. This is the correct way to handle canonicalization with pagination, as confirmed by Google’s John Mueller.
Is it Okay to Have Multiple Canonical Tags?
No, having multiple canonical tags on the same page is not good practice. Google is likely to ignore both canonical tags if this occurs, and the page may not be indexed.
For more insights on managing duplicate content and improving your website’s SEO, visit the Ranktracker Blog and explore our comprehensive SEO Guide. Additionally, familiarize yourself with key SEO terms and concepts in our SEO Glossary.