Canonical URLs: A Beginner's Guide to Canonical Tags

1 month ago 38
ARTICLE AD BOX

What Is a Canonical URL?

A canonical URL is the mentation of a webpage chosen by hunt engines similar Google arsenic the main mentation erstwhile determination are duplicates. And is prioritized to debar showing repetitive contented that doesn’t supply unsocial worth successful hunt results.

Consider these 2 URLs:

  • Canonical URL: https://example.com/blog/
  • Non-canonical (alternate) URL: https://example.com/blog/?page=1

In this example, Google volition apt take the canonical URL for indexing and ranking. 

The canonical leafage tin besides beryllium called the “principal,” “primary,” oregon “representative” version.

What Is a Canonical Tag?

A canonical tag (also known arsenic the rel="canonical" tag) is simply a snippet of HTML codification that allows you to specify the superior mentation successful a acceptable of duplicate oregon near-duplicate pages connected your site.

In SEO, canonical tags suggest to Google which mentation of the leafage it should index, consolidate nexus equity (ranking strength) to, and amusement successful hunt results.

Canonical tags are recovered successful the <head> conception of a webpage’s HTML root codification and look similar this:

<link rel="canonical" href="https://example.com/preferred-url-here/" />

Here’s however that works successful signifier connected 1 of the alternate pages:

split surface  showing an nonfiction  and its HTML code, highlighting "Alternate URL" and "Canonical Tag" with arrows

Typically, canonical tags constituent from an alternate leafage to the preferred page.

an illustration of canonical tag pointing from an alternate leafage   to a preferred one

But it’s besides a bully thought to usage self-referencing canonicals. 

In different words, each canonical leafage should person a canonical tag that points to its ain URL.

Like this:

split surface  of an nonfiction  and developer tools displaying HTML codification  highlighting a self-referencing canonical link

Google’s John Mueller confirmed the value of self-referencing canonicals successful a Google Search Central hangout.

Canonical tags are a invaluable deduplication tool. They tin resoluteness issues with duplicate content (or near-identical pages) you request to keep.

For example: 

  • American English and British English versions of the aforesaid page
  • Parameterized URLs (e.g., listing pages with filters oregon sorting options applied)

Why debar duplicate content?

Because it tin origin keyword cannibalization. This occurs erstwhile aggregate pages connected a tract vie for the aforesaid keywords. And harm each other’s rankings successful the process. 

infographic divided into 3  vertical sections, each   representing a antagonistic  interaction   of duplicate contented  connected  SEO

Using canonical tags correctly helps Google recognize your site’s structure. And place the champion mentation of a duplicated page.

This helps guarantee the mentation you privation is the 1 shown successful hunt results (and the 1 searchers access). Which tin pb to higher click-through and conversion rates.

Plus, Google consolidates the ranking powerfulness of alternate pages to canonical URLs.

Let’s accidental you person backlinks (links from outer domains) pointing to assorted duplicate pages. If you’ve utilized canonical tags, Google treats them each arsenic links to that main URL. To positively interaction rankings. 

an illustration of backlinks, alternate URLs and canonical URLs connection

How to Implement Canonical Tags

To instrumentality canonical tags successful your HTML, you tin adhd the rel="canonical" tag to the <head> conception of the page. 

As a reminder, that looks thing similar this:

<link rel="canonical" href="https://example.com/preferred-url-here/" />

But the nonstop mode to instrumentality them is simply a spot antithetic depending connected your platform. Let’s spell implicit 5 of the astir common:

Magento 1

If you’re moving a Magento 1 store, travel these steps to specify canonical URLs for merchandise and class pages.

Product Page Canonicals

Log successful to your admin panel, past caput to “System” > “Configuration.” 

Click “Catalog” and unfastened the “Search Engine Optimizations” section.

where to specify canonical URLs for merchandise  and class  pages successful  Magento 1

If it isn’t already, acceptable the “Use Canonical Link Meta Tag For Products” tract to “Yes.”

set the “Use Canonical Link Meta Tag For Products” tract  to “Yes”

Category Canonicals

Head backmost to the “Search Engine Optimizations” conception connected the “Catalog” page.

Find the “Use Canonical Link Meta Tag For Categories” enactment and marque definite it’s acceptable to “No.”

set the “Use Canonical Link Meta Tag For Categories” enactment    to "No"

Now, you tin manually specify the canonical URL for categories.

Head to the edit leafage of immoderate class you privation to canonicalize and find the “Custom Design” tab.

In the “Custom Layout Update” box, adhd the pursuing codification (making definite to swap successful your canonical URL).

<reference name="head">
<action method="addLinkRel">
<rel>canonical</rel>
<href>https://example.com/preferred-url-here/</href>
</action>
</reference>

“Custom Layout Update” container  successful  Magento 1

Magento 2

If you’re moving a Magento 2 store, travel these steps to specify canonical URLs crossed your site.

Log successful to your admin panel, past spell to “Stores” > “Settings” > “Configuration.”

Next, unfastened “Catalog” > “Catalog” and spell to the “Search Engine Optimization” section.

“Search Engine Optimization” conception  successful  Magento 2

Image Source: Amasty

Set “Use Canonical Meta Tags For Categories” to “Yes.” So Magento volition automatically adhd canonical tags to alternate class pages.

The default config way is “catalog/seo/category_canonical_tag.”

Also acceptable “Use Canonical Meta Tags For Products” to “Yes.” So Magento volition automatically adhd canonical tags to alternate merchandise pages.

The default config way is “catalog/seo/product_canonical_tag.”

Shopify

Shopify automatically handles canonical tags for merchandise pages, collections, and blog posts.

This built-in strategy works good for astir setups. Like if:

  • Your products person variants (like antithetic colors oregon sizes)
  • You usage pagination oregon filtering connected postulation pages
  • You person modular blog posts

If your tract is much analyzable and requires immoderate further enactment to instrumentality canonical tags, you tin adhd them manually.

Go to your Shopify admin, prime “Themes” from the paper to the left, and click “Actions” > “Edit Code.”

Shopify interface showing the "Themes" section, with a dropdown paper   highlighting the "Edit code" option

In the near sidebar, click connected the record you privation to edit. If you’re implementing thing that volition use crossed your site, you’d take “theme.liquid.” 

Shopify interface showing codification  exertion   with "theme.liquid" record  unfastened  and HTML codification  displayed

From here, you’ll request to edit the codification utilizing the due metafield (a tract you tin usage for customization). This requires a just magnitude of method know-how, truthful you whitethorn privation to enactment with a developer. 

There are besides respective Shopify apps disposable to adhd canonical tags. 

Canonical Tag URL Wizard is simply a fashionable choice. Because it enables you to negociate canonical tags without diving into code.

WordPress

You tin acceptable canonical URLs connected your WordPress tract by utilizing a WordPress SEO plugin

We’ll look astatine however to bash this with 2 of the astir fashionable plugins: Yoast SEO and Rank Math SEO.

Yoast SEO Plugin

If you’re utilizing the Yoast SEO plugin, caput to the Yoast SEO options connected immoderate leafage oregon post. 

Then, grow the “Advanced” tab. 

You’ll find a “Canonical URL” tract wherever you tin specify the page’s canonical URL.

“Advanced” tab successful  Yoast SEO options

Rank Math SEO Plugin

If you’re utilizing the Rank Math SEO plugin, caput to the “Rank Math SEO” container connected immoderate leafage oregon post. And unfastened the “Advanced” tab.

The “Canonical URL” tract allows you to specify the canonical URL for the page.

“Advanced” tab successful  “Rank Math SEO” box

Wix

Wix pages usage a self-referencing canonical tag by default.

You tin alteration the operation of your canonical tags by going into your SEO settings.

First, caput to “Site & Mobile App” > “Website & SEO” > “SEO.” And past take the benignant of leafage that you privation to edit.

Wix dashboard displaying the navigation sidebar with the "SEO" tract  highlighted

Scroll down until you spot “Tools & Settings” and prime “Go to SEO Settings” from nether “SEO Settings.”

Wix dashboard showing "Tools and settings" for SEO, with a highlighted "Go to SEO Settings" button

Then, prime the benignant of leafage you privation to set your canonical tags for.

For this workflow, we selected “Main Pages.” 

SEO settings sheet  with the "Main pages" enactment    highlighted by a purple border

Next, prime the “Edit” fastener adjacent to “Additional Meta Tags.”

SEO settings for Main Pages, with the past  section, "Additional meta tags," highlighted successful  a purple box

Then, adhd variables to the tract nether “canonical” by clicking connected “+ Add Variable.” And selecting applicable items from the database that appears.

Wix idiosyncratic    interface showing options for editing canonical tags

You tin besides edit the canonical tags of idiosyncratic pages. Just spell to your exertion and prime “Pages & Menu” > “Store Pages.” 

Then, find the leafage you’re focused on, click the three-dot icon, and prime “SEO Basics.”

Wix website exertion   displaying "Store Pages" nether  "Site Pages and Menu," with "SEO Basics" selected for the store  page

Then, spell to “Advanced SEO” > “Additional Tags.” And set the canonical tag according to your needs. 

canonical tags successful  the Wix website exertion   for the store  page

Other Ways to Specify Canonical URLs

Typically, you specify canonical URL preferences utilizing canonical tags. But determination are different methods.

Let’s look astatine these deduplication methods successful much detail.

A rel=“canonical” HTTP header allows you to specify a canonical URL for non-HTML documents.

For example, if you person a DOCX and PDF mentation of the aforesaid papers online, you tin usage this method to bespeak your preferred version.

But you request to beryllium capable to alteration your server’s configuration.

In the .htaccess file, specify a canonical URL by adding codification that looks similar this:

Header add Link: <https://www.example.com/downloads/filename.pdf>; rel="canonical"

Redirect Duplicate Pages to Canonical Pages

URL redirects nonstop Google (and users) from 1 leafage to another. 

Redirecting is the champion deduplication method if you don’t request to support the alternate versions of the page. But you don’t privation to delete the URLs altogether.

For example, erstwhile you person HTTP and HTTPS versions of the aforesaid page. 

Google prefers HTTPS versions. So, it’s bully for your SEO to redirect the HTTP mentation to the HTTPS one.

Google recommends utilizing 3xx redirects (server-side redirects) for the quickest results. 

This includes the 301 redirect, which you tin larn much astir successful our 301 redirect guide.

List Canonical URLs Only successful Your Sitemap

All the pages listed successful your sitemap bespeak your suggested canonical URLs, according to Google.

This means it’s a bully thought to taxable canonical URLs (and non-duplicated pages) lone successful your sitemap. And permission alternate URLs out. 

It’s not a immense contented if you permission duplicate pages successful your sitemap. Google volition determine which mentation is canonical. 

But it could beryllium a occupation if you accidentally permission preferred URLs out. So, support your sitemap updated.

If you don’t instrumentality canonicals correctly, Google mightiness disregard them. And that tin harm your SEO performance.

So, travel these canonical tag champion practices for the champion results:

Specify One Canonical URL Per Page

Only specify one canonical URL per page. Otherwise, you’ll confuse Google.

Be cautious not to accidentally see 2 canonical tags wrong your page's HTML code. If you acceptable the canonical tag utilizing a mounting successful your CMS, don't manually adhd further canonical tags to your HTML.

And if you adhd rel="canonical" to the HTML, don’t besides adhd it to the HTTP header.

Specify the Correct Domain Protocol

If your tract sits connected the HTTPS protocol, beryllium definite to notation this arsenic your canonical URL. 

Check retired our usher to larn much astir redirecting from HTTP to HTTPS.

Specify Trailing Slash oregon Non-Trailing Slash URLs

Pay attraction to whether your pages usage trailing slashes (i.e., “/” symbols astatine the extremity of URLs). 

For example: 

  • Trailing slash: https://example.com/
  • Non-trailing slash: https://example.com

If the aforesaid URL exists with some the trailing slash and without, Google whitethorn spot them arsenic 2 abstracted URLs. So, beryllium definite to notation your canonical URL correctly by including the trailing slash if needed.

And effort to beryllium accordant crossed your site.

Specify Non-WWW oregon WWW URLs

Search engines spot non-WWW and WWW versions of a URL arsenic duplicate pages.

For example: 

  • Non-WWW: https://example.com/
  • WWW: https://www.example.com/

It’s champion to take 1 mentation and instrumentality with it crossed your full site.

Use Absolute URLs

Canonical tags should beryllium referenced utilizing implicit URLs alternatively than comparative URLs.

That means you should usage the afloat URL, including your domain. Like this:

<link rel="canonical" href="https://example.com/blog/" />

And not a comparative URL. Like this:

<link rel="canonical" href="/blog/" />

Common Mistakes to Avoid When Implementing Canonical Tags

It’s casual to marque mistakes erstwhile implementing canonical tags. 

Here are immoderate of the much communal canonical tag errors:

Pointing Canonical Tags to Redirected Pages

Be cautious not to specify a canonical URL that redirects. This volition lone confuse Google.

For example, let’s accidental Page A redirects to Page B.

You shouldn’t person immoderate canonicals that constituent to Page A. They should constituent straight to Page B instead.

Using Canonical Tags for Non-Duplicate Content

Only acceptable canonical URLs for duplicate oregon near-identical content. 

Some SEOs effort to usage canonical tags to consolidate the ranking powerfulness of dissimilar pages. Like directing authorization from out-of-stock merchandise pages to class pages.

But Google advises against this practice. And is highly apt to disregard these canonicals.

You besides mightiness beryllium tempted to usage canonical tags for akin products. But adjacent if 2 products are alike (like 2 antithetic models of headphones), they should some person their ain sets of canonical tags.

If Google honors those canonical tags, users whitethorn conflict to observe applicable products. And that tin negatively interaction your sales.

Placing Canonical Tags successful the Wrong Place

Canonical tags indispensable beryllium successful the <head> conception of your HTML. 

If you enactment them successful the incorrect place, hunt engines mightiness not find oregon admit them. And your pages mightiness extremity up competing against each different successful hunt results.

To double-check that your placement is close for immoderate page, spell to that page’s URL, right-click connected the page, and prime “View Page Source.”

Semrush Blog nonfiction  with the browser discourse  paper   successful  the foreground and a airy  purple arrow pointing to "View leafage   source"

Then, benignant Command + F (on a mac) oregon Ctrl + F (on a PC), and participate “canonical.”

You should past beryllium capable to spot whether it’s located successful the due place.

article HTML codification  with the <link rel="canonical"> tag highlighted

If it's not successful the <head> section, you’ll privation to determination it there.

Having Conflicting Canonical and Hreflang Tags

When you person a multilingual site, you'll often usage some canonical tags and hreflang tags (HTML that specifies a page’s connection and sometimes its location). 

Canonical tags archer hunt engines which mentation of a leafage is the main one. 

Hreflang tags archer hunt engines which connection you're utilizing connected a circumstantial page. To guarantee the close mentation is shown to users successful antithetic countries. 

diagram showing an hreflang tag with connection   worth  (en-us) successful  red, state  worth  (us) successful  green, and URL successful  purple

Let's accidental you person a leafage astir cats successful 3 languages.

  • English: https://example.com/cats
  • Spanish: https://example.com/es/gatos
  • French: https://example.com/fr/chats

A communal mistake would beryllium to database “https://example.com/cats” arsenic the canonical URL connected each page. 

That sends conflicting messages to Google. And could effect successful the incorrect connection mentation being shown to users successful a fixed country.

To instrumentality some tags correctly, each leafage should state itself arsenic the main mentation successful its language. And database each disposable connection versions, including itself.

On the English page, you'd use:

<link rel="canonical" href="https://example.com/cats" />
<link rel="alternate" hreflang="en" href="https://example.com/cats" />
<link rel="alternate" hreflang="es" href="https://example.com/es/gatos" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/chats" />

On the Spanish page, you'd use:

<link rel="canonical" href="https://example.com/es/gatos" />
<link rel="alternate" hreflang="en" href="https://example.com/cats" />
<link rel="alternate" hreflang="es" href="https://example.com/es/gatos" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/chats" />

On the French page, you'd use:

<link rel="canonical" href="https://example.com/fr/chats" />
<link rel="alternate" hreflang="en" href="https://example.com/cats" />
<link rel="alternate" hreflang="es" href="https://example.com/es/gatos" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/chats" />

Find retired what Google considers to beryllium the canonical URL for immoderate leafage connected your website with Google Search Console.

After logging in, hunt for a URL astatine the top.

Google Search Console interface highlighting a URL successful  the hunt  bar

When the “URL Inspection” study is ready, unfastened the “Page indexing” section.

Scroll down to spot the “Google-selected canonical.”

Google Search Console showing “URL Inspection” study  with the “Google-selected canonical" successful  the “Page indexing” section

If this isn’t your preferred URL, you whitethorn request to reappraisal your deduplication efforts. 

To start, marque definite that the “User-declared canonical” is contiguous and correct.

To audit your site’s canonical tags astatine scale, usage Semrush’s Site Audit tool.

Open the tool, participate your domain, and click "Start Audit."

Semrush's Site Audit instrumentality   interface with an input tract  for a website URL and a greenish  "Start Audit" button

Configure your Site Audit Settings to acceptable up your crawl. And purpose to crawl arsenic galore pages arsenic possible—to guarantee you don’t miss immoderate issues. 

Check the container adjacent to "Send an email each clip an audit is complete." And click "Start audit."

"Site Audit Settings" model   with navigation paper   and configuration options

When the audit is done, spell to the “Issues” tab. And hunt “canonical.”

Site Audit instrumentality   "Issues" tab highlighting canonical issues recovered  connected  a website

Check for the pursuing errors:

  • # pages person duplicate contented issues
  • # pages person aggregate canonical URLs
  • # pages with a breached canonical link
  • # AMP pages person nary canonical tag
Site Audit results showing the database  of antithetic  issues and errors, including duplicate contented  and breached  canonical links

Let’s look astatine what these issues are and however to hole them.

# Pages Have Duplicate Content Issues

This mistake shows however galore pages connected your tract could beryllium considered duplicates. Because they diagnostic contented that’s astatine slightest 85% identical to the contented connected different page.

Click the nexus to spot affected URLs.

results leafage   displaying 17,764 pages with duplicate contented  issues for circumstantial  URLs

You tin past determine however to resoluteness the issue. See our duplicate contented guide for advice.

# Pages Have Multiple Canonical URLs

This mistake shows however galore pages connected your tract specify much than 1 canonical URL.

Click the nexus to presumption a elaborate breakdown.

"3 pages person  aggregate  canonical URLs" page

To hole this issue, region the other canonical tag(s). And permission conscionable 1 successful place. 

This contented shows which pages connected your tract person breached canonical links—i.e., specify a canonical URL that doesn’t work.

(Perhaps due to the fact that it contains a typo. Or the leafage has been deleted.)

Click the nexus to spot the affected pages and the canonical URLs they constituent to.

"Issues" tab showing 120 pages with breached  canonical links

Canonical tags that constituent to non-existent webpages complicate Google’s quality to crawl and scale your contented properly. That could harm your rankings.

So, marque definite to update these to the close canonical URLs.

# AMP Pages Have No Canonical Tag

When your AMP pages don’t person canonical tags, the Site Audit instrumentality flags it arsenic an issue. It’s important that canonicalization beryllium successful spot betwixt AMP and non-AMP versions of your page.

You tin hole this occupation by adding a rel="canonical" tag successful the <head> conception of each AMP leafage that points backmost to the non-AMP page.

Like this:

how to hole  an AMP leafage   without a canonical tag

When you’ve fixed this and immoderate different issues, rerun the Site Audit utilizing the cogwheel icon. 

highlighted cogwheel  icon successful  the upper-right corner, showing a dropdown paper   with an enactment    to rerun the campaign

Then, cheque that the canonical errors person disappeared by utilizing the hunt barroom erstwhile more. 

Start Specifying Canonical URLs

Correctly implementing canonical tags is simply a cardinal portion of method SEO. And tin assistance amended your integrated hunt rankings.

So, audit your website to spot if it has immoderate issues related to canonical URLs.

Try it with Site Audit.

This station was updated successful 2024. Excerpts from the archetypal nonfiction by James Brockbank whitethorn remain.