A canonical URL is the URL of the page that search engines should treat as the definitive version when multiple URLs show the same or very similar content. You declare it using the rel="canonical" HTML tag.
Without a canonical tag, Google has to guess which version of your page to index — and it often guesses wrong, splitting your ranking power across multiple URLs instead of concentrating it on one.
What is a Canonical Tag?
The canonical tag is a snippet of HTML placed in the <head> section of a page:
<link rel="canonical" href="https://yourdomain.com/your-page/" />
It tells Google: "No matter how you arrived at this page, the version you should index and rank is the one at this URL."
When Do You Need a Canonical URL?
Duplicate content is more common than most website owners realize. You need canonical tags when:
- HTTP and HTTPS versions of your site are both accessible
- www and non-www versions return the same content
- Trailing slash and no trailing slash URLs both work (
/pagevs/page/) - URL parameters create new URLs:
/products?sort=pricevs/products?sort=name - Paginated pages (
/blog/page/2) contain overlapping content - Printer-friendly versions of pages exist at separate URLs
- Content is syndicated on other websites (they should canonical back to you)
Self-Referencing Canonical: Should Every Page Have One?
Yes — even if you have no duplicate content, adding a self-referencing canonical tag on every page is best practice. It explicitly tells Google which URL is authoritative and prevents any accidental duplication from being mishandled.
<!-- On https://yourdomain.com/about/ -->
<link rel="canonical" href="https://yourdomain.com/about/" />
Canonical vs 301 Redirect: What's the Difference?
| Situation | Use Canonical | Use 301 Redirect |
|---|---|---|
| Both URLs should remain accessible | ✓ | ✗ |
| Old URL should be completely replaced | ✗ | ✓ |
| URL parameters on same content | ✓ | Either |
| Domain migration | ✗ | ✓ |
| Paginated content | ✓ | ✗ |
| HTTPS migration (from HTTP) | Both, but redirect preferred | ✓ |
A 301 redirect is stronger than a canonical tag — if you can redirect, do that. Use canonical when you need both URLs to remain accessible.
Common Canonical Tag Mistakes
1. Canonical pointing to a different domain
If your canonical tag points to an external URL, you're telling Google to index someone else's page instead of yours. Check every canonical carefully.
2. Multiple canonical tags on one page
If a page has two rel="canonical" tags, Google ignores both. One canonical per page, always.
3. Canonical on paginated pages all pointing to page 1
Setting canonical on /blog/page/2 to point to /blog/ tells Google not to index page 2 at all. Use a self-referencing canonical on paginated pages instead.
4. Canonical URL not matching the HTTPS/www version exactly
The canonical URL must be the exact, full, preferred version including protocol and subdomain:
<!-- Wrong -->
<link rel="canonical" href="http://yourdomain.com/page/" />
<!-- Correct -->
<link rel="canonical" href="https://yourdomain.com/page/" />
5. No canonical on e-commerce filter pages
Filter URLs like /shoes?color=red&size=42 are among the most common sources of duplicate content on e-commerce sites. Every filter combination needs a canonical pointing to the base category URL.
How to Check Canonical Tags on Your Website
Use Optyxo's Canonical URL Checker — enter any URL and instantly see:
- The canonical tag value on that page
- Whether it matches the current URL (self-referencing) or points elsewhere
- Whether the canonical URL is accessible and returns a 200 status
The full Optyxo SEO audit also checks canonical implementation across your entire website as part of the Technical SEO category.
How to Add Canonical Tags
In WordPress: Install Yoast SEO or Rank Math — they add canonical tags automatically based on your URL structure.
In HTML manually: Add to the <head> section of every page:
<link rel="canonical" href="https://yourdomain.com/exact-page-url/" />
In PHP/Yii2:
Yii::$app->view->registerLinkTag(['rel' => 'canonical', 'href' => 'https://yourdomain.com/page/']);
In .htaccess (force canonical domain):
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
Frequently Asked Questions
Does a canonical tag guarantee Google will use my preferred URL?
No — canonical is a hint, not a directive. Google respects it in the vast majority of cases, but may override it if it detects strong signals that another URL is the more authoritative version (e.g., if the non-canonical URL has significantly more backlinks). 301 redirects are the only guaranteed way to consolidate URLs.
Can I use canonical across different domains?
Yes. Cross-domain canonicals are used when you publish content on a third-party platform and want to indicate that your website is the original. The third-party page sets its canonical to your URL. Google supports this, though it's applied less consistently than same-domain canonicals.
How long does it take for Google to process a new canonical tag?
Google typically processes canonical tag changes within a few days to a few weeks, depending on how frequently it crawls your site. High-traffic sites may see changes reflected within 24-48 hours. Check Google Search Console's URL Inspection tool to verify which URL Google is indexing.
What happens if I don't add a canonical tag?
Google will choose a canonical for you — and its choice may not match your preference. If you have both HTTP and HTTPS, or www and non-www versions accessible, Google may index the wrong one, splitting your link equity and search visibility. Always set canonicals explicitly.
How do I check if my canonical tags are working?
Use Optyxo's Canonical Checker to inspect any URL instantly. For a site-wide check, use Optyxo's full SEO audit — it checks canonical implementation as part of the Technical SEO category and flags any misconfigured tags.