What is a Canonical URL? A Guide to Preventing Duplicate Content for SEO
Duplicate content is a common SEO problem where the same or very similar content appears on multiple URLs. This confuses search engines, forcing them to choose which version to rank and splitting your "link equity" (the SEO value passed by links) across multiple pages. The solution is the canonical tag.
A canonical tag (rel="canonical"
) is a snippet of HTML code that tells search engines which version of a URL is the "master" or "preferred" version you want to appear in search results.
Why Does Duplicate Content Happen?
You might not realize you have duplicate content, but it's very common. A single page can often be accessed through many different URLs:
- HTTP vs. HTTPS:
http://example.com
andhttps://example.com
. - WWW vs. non-WWW:
https://www.example.com
andhttps://example.com
. - Trailing Slashes:
/page/
and/page
. - URL Parameters:
/products?sort=price
and/products?sort=name
might show the same products in a different order. - Print-Friendly Versions:
/my-article/
and/my-article/print
.
To a search engine, each of these is a separate page, even though they show the same content. This dilutes your SEO power.
How to Implement a Canonical Tag
The canonical tag is a <link>
element that you place in the <head>
section of your HTML. It points to the URL that you want to be considered the authoritative source.
<!DOCTYPE html>
<html>
<head>
<title>My Page Title</title>
<!-- This tells search engines that the preferred version of this page is the HTTPS, non-WWW URL -->
<link rel="canonical" href="https://example.com/my-awesome-page" />
</head>
<body>
...
</body>
</html>
The Self-Referencing Canonical
It is a best practice for every page to have a self-referencing canonical tag. This means a page's canonical tag points to its own URL. This seems redundant, but it's a clear signal to Google that this is the version you want indexed and protects you from unforeseen issues with URL parameters.
For the page at `https://example.com/about-us`, the canonical tag should be:
<link rel="canonical" href="https://example.com/about-us" />
Pro Tip: Use absolute URLs (the full URL including `https://...`) in your canonical tags, not relative URLs. This prevents potential errors and is Google's recommended practice.
Canonical Tags for Cross-Domain Duplicates
Canonical tags can also be used when you republish your content on other websites (syndication). If you post your blog article on your own site and also on Medium.com, you can ask Medium to add a canonical tag pointing back to your original article. This tells Google that your website is the original source and that all SEO value should be passed to you.
Canonical Tag vs. 301 Redirect
These two are often confused, but they serve different purposes.
- Canonical Tag: A "suggestion" for search engines. It tells them which page to show in search results, but users can still visit all versions of the URL. Use this for pages with similar content.
- 301 Redirect: A "mandate" for both users and search engines. It permanently sends everyone from an old URL to a new one. Use this when a page has moved permanently.
If you can redirect, that's usually the stronger signal. If you need both pages to be accessible to users but want to consolidate SEO value, use a canonical tag.
Conclusion
Canonical tags are a simple but powerful tool for managing duplicate content and focusing your SEO efforts.
- Use a canonical tag to specify the "master" version of a page.
- Place the
<link rel="canonical" href="...">
tag in the<head>
of all duplicate pages. - It's a best practice for every page to have a self-referencing canonical tag.
- Use absolute URLs for your canonical links.
By correctly implementing canonical tags, you help search engines understand your site better, which is a critical step toward improving your rankings.
Use our Live HTML Viewer to check the <head>
section of your pages and ensure your canonical tags are set up correctly.