February 13, 2025

What Is a Canonical URL?

A canonical URL is the principle model of a webpage chosen and prioritized by engines like google like Google when duplicates exist to keep away from exhibiting repetitive content material in search outcomes.

Think about these two URLs:

  • Canonical URL: https://instance.com/weblog/
  • Non-canonical (alternate) URL: https://instance.com/weblog/?web page=1

On this instance, Google will seemingly select the canonical URL for indexing and rating.

The canonical web page will also be referred to as the “principal,” “main,” or “consultant” model.

What Is a Canonical Tag?

A canonical tag (also referred to as the rel=”canonical” tag) is an HTML snippet that defines the first model amongst duplicate or near-duplicate pages in your website. 

In search engine marketing, canonical tags inform Google which web page model to index, consolidate hyperlink fairness (rating energy) to, and show in search outcomes.

Canonical tags seem within the <head> part of a webpage’s HTML supply code and appear to be this:

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

On alternate pages, canonical tags sometimes level to the popular web page. 

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

Sometimes, a canonical tag on an alternate web page factors from the alternate model to the popular web page:

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

Utilizing self-referencing canonical tags can also be a good suggestion, that means every canonical web page ought to have a canonical tag that factors to its personal URL.

split screen of an article and developer tools displaying HTML code highlighting a self-referencing canonical link

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

It is best to use canonical tags as a result of they will resolve points with duplicate content material or near-identical pages that you should maintain.

Examples embrace:

  • American English and British English variations of the identical web page
  • Parameterized URLs (e.g., itemizing pages with filters or sorting choices utilized)

Duplicate content material may cause key phrase cannibalization, which happens when a number of pages on a website compete for a similar key phrases and hurt one another’s rankings.

infographic divided into three vertical sections, each representing a negative impact of duplicate content on SEO

Utilizing canonical tags appropriately helps Google perceive your website’s construction and establish the most effective model of a duplicated web page to make sure the model you need is the one proven in search outcomes and accessed by searchers, probably resulting in greater click-through and conversion charges.

Moreover, Google consolidates the rating energy of alternate pages to canonical URLs. 

For instance, when you’ve got backlinks (hyperlinks from exterior domains) pointing to varied duplicate pages, canonical tags trigger Google to deal with all of them as hyperlinks to the principle URL, positively impacting rankings.

an illustration of backlinks, alternate URLs and canonical URLs connection

Add canonical tags to your HTML by inserting the rel=”canonical” tag within the <head> part of the web page, adopted by the URL you contemplate the canonical model.

For instance:

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

Nonetheless, the precise implementation varies relying in your platform. Let’s discover 5 of the commonest strategies:

Magento 1

To specify canonical URLs for product and class pages in Magento 1 shops, comply with these steps:

Product Web page Canonicals

Log in to your admin panel and navigate to “System” > “Configuration.”

Click on “Catalog” and open the “Search Engine Optimizations” part. 

where to specify canonical URLs for product and category pages in Magento 1

Make sure the “Use Canonical Hyperlink Meta Tag For Merchandise” area is ready to “Sure.”

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

Class Canonicals

Go to “Catalog” and open the “Search Engine Optimizations” part. 

Be sure that the “Use Canonical Hyperlink Meta Tag For Classes” possibility is ready to “No.”

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

Now you can manually specify the canonical URL for classes. 

Go to the edit web page of the specified class and find the “Customized Design” tab.

Add the next code to the “Customized Format Replace” field, changing “https://instance.com/preferred-url-here/” together with your canonical URL.

<reference title="head">
<motion technique="addLinkRel">
<rel>canonical</rel>
<href>https://instance.com/preferred-url-here/</href>
</motion>
</reference>

“Custom Layout Update” box in Magento 1

Magento 2

To specify canonical URLs in your Magento 2 retailer, comply with these steps: 

Log in to your admin panel and navigate to “Shops” > “Settings” > “Configuration.” 

Then, open “Catalog” > “Catalog” and go to the “Search Engine Optimization” part.

“Search Engine Optimization” section in Magento 2

Picture Supply: Amasty

Set “Use Canonical Meta Tags For Classes” to “Sure.” Magento will robotically add canonical tags to alternate class pages.

The default config path is “catalog/search engine optimisation/category_canonical_tag.” 

Additionally, set “Use Canonical Meta Tags For Merchandise” to “Sure.” Magento will robotically add canonical tags to alternate product pages. 

The default config path is “catalog/search engine optimisation/product_canonical_tag.”

Shopify

Typically, don’t fear an excessive amount of about canonicals for those who use Shopify—the platform robotically manages canonical tags for product pages, collections, and weblog posts. 

This built-in system works properly for many setups, corresponding to when:

  • Your merchandise have variants (like totally different colours or sizes)
  • You utilize pagination or filtering on assortment pages
  • You’ve gotten normal weblog posts

In case your website is extra complicated and requires extra canonical tag implementation, you may add them manually. 

In your Shopify admin, choose “Themes” from the left menu, then click on the three dots and select “Edit Code.”

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

Within the left sidebar, click on on the file you wish to edit. To implement site-wide adjustments, select “theme.liquid.”

Shopify interface showing code editor with "theme.liquid" file open and HTML code displayed

From right here, edit the code utilizing the suitable metafield (a area for personalisation). 

Metafield modifications require technical experience, so it’s possible you’ll wish to work with a developer.

Alternatively, a number of Shopify apps can be found so as to add canonical tags. 

Canonical Tag URL Wizard is a well-liked alternative as a result of it lets you handle canonical tags with out coding.

WordPress

Set canonical URLs in your WordPress website utilizing a WordPress search engine marketing plugin. 

Under are directions for setting canonical URLs with two standard plugins: Yoast search engine marketing and Rank Math search engine marketing.

Yoast search engine marketing Plugin

To set a canonical URL utilizing the Yoast SEO plugin, navigate to the Yoast search engine marketing choices on any web page or publish.

Develop the “Superior” tab.

Specify the web page’s canonical URL within the ”Canonical URL” area.

“Advanced” tab in Yoast SEO options

Rank Math search engine marketing Plugin

To set the canonical URL utilizing the Rank Math SEO plugin, go to the “Rank Math search engine marketing” field on any web page or publish and open the “Superior” tab.

Enter the canonical URL within the “Canonical URL” area.

“Advanced” tab in “Rank Math SEO” box

Wix

Wix pages use self-referencing canonical tags by default. 

You possibly can change the construction of canonical tags within the search engine marketing settings.

First, go to “Web site & Cell App” > “Web site & search engine marketing” > “search engine marketing,” then select the kind of web page to edit.

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

Scroll all the way down to “Instruments & Settings” and choose “Go to search engine marketing Settings” below “search engine marketing Settings.” 

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

Then, choose the kind of web page to regulate canonical tags for.

On this instance pictured, we chosen “Fundamental Pages.”

SEO settings panel with the "Main pages" option highlighted by a purple border

Subsequent, click on the “Edit” button subsequent to “Extra Meta Tags.” 

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

Add variables to the sphere below “canonical” by clicking “+ Add Variable” and choosing related gadgets from the listing.

Wix user interface showing options for editing canonical tags

To edit the canonical tags of particular person pages, go to the editor and choose “Pages & Menu” > “Retailer Pages.”

Discover the specified web page, click on the three-dot icon, and choose “search engine marketing Fundamentals.” 

Wix website editor displaying "Store Pages" under "Site Pages and Menu," with "SEO Basics" selected for the shop page

Then, navigate to “Superior search engine marketing” > “Extra Tags” and alter the canonical tag as wanted.

canonical tags in the Wix website editor for the shop page

Different Methods to Specify Canonical URLs

Sometimes, you specify canonical URL preferences utilizing canonical tags; nevertheless, different strategies exist.

We’ll study these deduplication strategies in additional element.

Use a rel=”canonical” HTTP header to specify the canonical URL for non-HTML paperwork. 

For instance, when you’ve got DOCX and PDF variations of the identical doc on-line, utilizing the rel=”canonical” HTTP header allows you to point out your most popular model.

Nonetheless, it’s essential to be capable of modify your server’s configuration. 

Within the .htaccess file, specify the canonical URL by including the next code (adjusted to your chosen doc):

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

Redirect Duplicate Pages to Canonical Pages

URL redirects ship Google and customers from one web page to a different and are good for deduplication while you don’t must maintain alternate variations of a web page however don’t wish to delete the URLs altogether. 

For instance, when you’ve HTTP and HTTPS variations of the identical web page.

Google prefers HTTPS variations, which suggests redirecting the HTTP model to the HTTPS one can enhance your search engine marketing.

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

An instance is the 301 redirect. Study extra about 301 redirects in our 301 redirect information.

Listing Canonical URLs Solely in Your Sitemap

Submit solely canonical URLs (non-duplicated pages) in your sitemap and exclude alternate URLs as a result of Google says they contemplate all pages listed in your sitemap as your recommended canonical URLs

Leaving duplicate pages in your sitemap will not be a significant challenge; Google will decide the canonical model.

Nonetheless, guarantee your sitemap is commonly up to date—omitting most popular URLs could trigger issues.

Google may ignore incorrectly carried out canonicals, harming your search engine marketing efficiency. Observe these canonical tag greatest practices for optimum outcomes:

Specify One Canonical URL Per Web page

Solely specify one canonical URL per web page to keep away from complicated Google. 

Keep away from unintentionally together with two canonical tags in your web page’s HTML code.

For those who set the canonical tag in your CMS settings, don’t manually add canonical tags to your HTML. 

For those who add rel=”canonical” to the HTML, don’t additionally add it to the HTTP header.

Specify the Right Area Protocol

Embrace HTTPS in your canonical URL in case your website makes use of HTTPS.

Seek advice from our information to study extra about redirecting from HTTP to HTTPS.

Specify Trailing Slash or Non-Trailing Slash URLs

Guarantee constant use of trailing slashes (i.e., “/” on the finish of URLs) in your pages and reference your canonical URL appropriately by together with the trailing slash if wanted.

In any other case, Google may deal with the beneath URLs as separate pages:

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

Specify NonWWW or WWW URLs

Engines like google contemplate non-WWW and WWW variations of a URL as duplicate pages, so select one model and keep it up. 

In any other case, the beneath URLs might be seen as duplicate pages:

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

Use Absolute URLs

Use absolute URLs (the total URL that features your area) for canonical tags as an alternative of relative URLs. 

For instance:

<hyperlink rel="canonical" href="https://instance.com/weblog/" />

Don’t use a relative URL, corresponding to:

<hyperlink rel="canonical" href="/weblog/" />

Implementing canonical tags usually results in errors, together with:

Pointing Canonical Tags to Redirected Pages

Keep away from specifying a canonical URL that redirects as a result of it’s going to confuse Google.

For instance, don’t have canonical tags pointing to Web page A if Web page A redirects to Web page B. Canonical tags ought to level on to Web page B as an alternative.

Utilizing Canonical Tags for Non-Duplicate Content material

Solely set canonical URLs for duplicate or near-identical content material to align with Google’s suggestions.

Some SEOs attempt to use canonical tags to consolidate the rating energy of dissimilar pages, corresponding to directing authority from out-of-stock product pages to class pages. 

Nonetheless, Google advises against this observe and is extremely prone to ignore these canonicals.

You may additionally be tempted to make use of canonical tags for related merchandise. However even when two merchandise are alike—for instance, two totally different fashions of headphones—they need to every have their very own units of canonical tags.

If Google honors improper canonical tags for related however not duplicate pages, customers could battle to find related merchandise, which might negatively affect your gross sales.

Inserting Canonical Tags within the Mistaken Place

Canonical tags have to be within the <head> part of your HTML.

Inserting canonical tags outdoors the <head> part can forestall engines like google from discovering or recognizing them, inflicting your pages to compete towards one another in search outcomes.

To confirm the location of canonical tags, navigate to the web page’s URL, right-click on the web page, and choose ”View web page supply.” 

Semrush Blog article with the browser context menu in the foreground and a light purple arrow pointing to "View page source"

Then, press Command + F (on a Mac) or Ctrl + F (on a PC) and seek for ”canonical” to see whether or not the canonical tag is situated within the correct place.

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

If the canonical tag isn’t within the <head> part, transfer it there.

Having Conflicting Canonical and Hreflang Tags

Multilingual websites usually use each canonical tags and hreflang tags (HTML that specifies a web page’s language and typically its location), which might be complicated to engines like google. 

Canonical tags inform engines like google which model of a web page is the principle one.

Hreflang tags inform engines like google which language a selected web page makes use of, making certain the proper model is proven to customers in several international locations.

diagram showing an hreflang tag with language value (en-us) in red, country value (us) in green, and URL in purple

Suppose you’ve a web page about the identical subjects in three languages:

  • English: https://instance.com/subject
  • Spanish: https://instance.com/es/tema
  • French: https://instance.com/fr/sujet

A standard mistake is itemizing “https://instance.com/subject” because the canonical URL on every web page. 

This strategy sends conflicting messages to Google and will outcome within the unsuitable language model being proven to customers in a given nation.

To implement each tags appropriately, every web page ought to declare itself as the principle model in its language and listing all out there language variations, together with itself.

On the English web page, use:

<hyperlink rel="canonical" href="https://instance.com/subject" />
<hyperlink rel="alternate" hreflang="en" href="https://instance.com/subject" />
<hyperlink rel="alternate" hreflang="es" href="https://instance.com/es/tema" />
<hyperlink rel="alternate" hreflang="fr" href="https://instance.com/fr/sujet" />

On the Spanish web page, use:

<hyperlink rel="canonical" href="https://instance.com/es/tema" />
<hyperlink rel="alternate" hreflang="en" href="https://instance.com/subject" />
<hyperlink rel="alternate" hreflang="es" href="https://instance.com/es/tema" />
<hyperlink rel="alternate" hreflang="fr" href="https://instance.com/fr/sujet" />

On the French web page, use:

<hyperlink rel="canonical" href="https://instance.com/fr/sujet" />
<hyperlink rel="alternate" hreflang="en" href="https://instance.com/subject" />
<hyperlink rel="alternate" hreflang="es" href="https://instance.com/es/tema" />
<hyperlink rel="alternate" hreflang="fr" href="https://instance.com/fr/sujet" />

Use Google Search Console to find out the canonical URL that Google acknowledges for any web page in your web site. 

Log in and enter a URL on the prime.

Google Search Console interface highlighting a URL in the search bar

When the ”URL Inspection” report seems, open the “Web page indexing” part. 

Scroll down to seek out the ”Google-selected canonical.”

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

If this URL isn’t your most popular canonical, evaluation your deduplication work.

First, affirm that the “Person-declared canonical” is current and correct. 

To audit your website’s canonical tags at scale, use Semrush’s Web site Audit device.

Open the device, enter your area, and click on “Begin Audit.” 

Semrush's Site Audit tool interface with an input field for a website URL and a green "Start Audit" button

Configure your Web site Audit settings to arrange your crawl.

Intention to crawl as many pages as potential to keep away from lacking any points.

Choose the field subsequent to “Ship an e-mail each time an audit is full” and click on “Begin Audit.” 

"Site Audit Settings" window with navigation menu and configuration options

When the audit finishes, go to the “Points” tab and seek for “canonical.”

Site Audit tool "Issues" tab highlighting canonical issues found on a website

Verify for the next errors:

  • # pages have duplicate content material points
  • # pages have a number of canonical URLs
  • # pages with a damaged canonical hyperlink
  • # AMP pages don’t have any canonical tag
Site Audit results showing the list of different issues and errors, including duplicate content and broken canonical links

# Pages Have Duplicate Content material Points

The “# pages have duplicate content material points” error signifies the variety of pages in your website that could be thought of duplicates, that means pages that comprise content material not less than 85% equivalent to a different web page.

Click on the hyperlink to see affected URLs. 

results page displaying 17,764 pages with duplicate content issues for specific URLs

Then resolve how one can resolve the problem. See our duplicate content material information for recommendation.

# Pages Have A number of Canonical URLs

The “# pages have a number of canonical URLs” error signifies the variety of pages in your website which have multiple canonical URL. 

Click on the hyperlink for an in depth breakdown.

"3 pages have multiple canonical URLs" page

To repair this challenge, take away the additional canonical tags till you’re left with one.

Pages with a damaged canonical hyperlink specify a canonical URL that doesn’t work. 

The canonical URL could also be damaged as a result of a typo or as a result of the web page has been deleted. 

Click on the hyperlink to see the affected pages and their specified canonical URLs.

"Issues" tab showing 120 pages with broken canonical links

Canonical tags pointing to non-existent webpages complicate Google’s capacity to crawl and index your content material correctly, which may hurt your rankings. 

Make sure you replace your tags to the right canonical URLs.

# AMP Pages Have No Canonical Tag

If AMP pages lack canonical tags, the Web site Audit device flags this as a difficulty as a result of canonicalization ought to be in place between AMP and non-AMP variations of your web page.

Add a rel=”canonical” tag within the <head> part of every AMP web page pointing again to the non-AMP web page to repair this challenge. 

Just like the picture beneath reveals:

how to fix an AMP page without a canonical tag

After fixing the “# AMP pages don’t have any canonical tag” challenge and another points, rerun the Web site Audit utilizing the gear icon. 

highlighted gear icon in the upper-right corner, showing a dropdown menu with an option to rerun the campaign

Use the search bar to confirm that the canonical errors have disappeared.

Begin Specifying Canonical URLs

Implementing canonical tags appropriately is a key a part of technical search engine marketing and will help enhance your natural search rankings. 

To search out any points associated to canonical URLs in your web site, run an audit.

Strive it with Web site Audit. 

This publish was up to date in 2024. Excerpts from the unique article by James Brockbank could stay.