Supercharge Your Site’s SEO With Canonical URLs
Don’t worry, canonical URLs have nothing to do with firearms and war. Derived from the word canon, which refers to a commonly shared principle or law, a canonical URL indicates your preferred version among duplicate webpages. This allows search engines to optimally crawl, index, and interpret your website's content.
Overview: What is a canonical URL?
Canonical URLs are about being on the same page as search engines. Literally. It is a small piece of source code inserted in a webpage that directs search engines to the page they should be showing when there are several versions of the same page or content.
How does a canonical URL affect SEO?
The value of a canonical URL for SEO lies in the control it gives you over what content from your website is visible in search engines. Canonical URLs allow you to:
- Avoid multiple versions of the same content being indexed
- Free up crawl budget to index the important pages
- Make sure the most important URL is indexed for duplicate content
How to implement canonical URLs when generating content for your website
The first thing you should do in implementing canonical URLs is to create a sitemap of your reference URLs and submit it via Google Search Console and other webmaster tools. But this is not always enough.
URL canonicalization can be achieved in a couple of different ways depending on your website setup and how the website was built. Oftentimes, your site will be built with a content management system (CMS) such as WordPress or Wix or an e-commerce store builder such as Shopify or Squarespace. Each system manages and creates URLs differently.
CMS software is getting better at managing URLs and can provide a shortcut for implementing canonical URLs.
Let's go through the steps of implementing canonical URLs.
1. Check your canonicality
Ideally, you should start by performing an SEO audit to figure out whether canonical URLs are already implemented and will contribute to better SEO performance.
If you have a duplicate content issue or a problem having all your pages indexed by search engines, then it is worth addressing. You can use an SEO tool to crawl your site for duplicate content and check whether you already have canonical tags in place.
2. Identify reference URLs and canonicalization rules
Next, we need to identify the way to canonicalize. If you are looking at just a few URLs, the solution is simple. You simply define the canonical URL, referencing the original page, and note the page or pages that need canonicalization with an inserted line of code.
But in many cases, you will discover that your site is filled with different versions of pages. In this case, you may have to design rules and have the tags implemented by a developer. Rules can be as simple as https://www.yourdomain.com/homepage/1/ and https://www.yourdomain.com/homepage/2/ and all other https://www.yourdomain.com/homepage/n/ where 'n' is a number, should reference https://www.yourdomain.com/homepage/ as the correct URL.
Another common case is that an e-commerce website will allow for many different views of the same content by using parameters in the URL. As an example, you could have a product page named summerdress/ and the e-commerce website creates individual URLs for each color of the dress such as summerdress/blue/ and summerdress/pink/. In this case, the rule will be to reference the summerdress/ URL as the canonical URL for all the pages.
3. Decide on implementation mode
The easiest way to implement canonical URLs is by inserting a line of code with the rel=canonical instruction in the <head> section of each page. Via a CMS, there are often plugins or native functions allowing you to implement these across your site.
For more complex implementations, you can instruct your developer to find the best way based on the rules and list of canonical instances you have identified in the former step.
Other implementations for canonical URLs exist. It is possible to provide them in the HTTP header by modifying a file called .htaccess. It is not overly complicated but if you make errors in the file, your entire site will stop working and provide a server error. Handle with care.
Finally, it is possible to achieve canonical effects without tags. As mentioned at the beginning, you can achieve some of your objectives by simply providing a sitemap to search engines. It is also possible to use 301 redirects from duplicate to primary URLs when neither users nor search engines need the duplicates.
4. Verify impact
After implementation, you should check that the canonical tags appear as they should by looking at the source code of some of the pages carrying duplicate content.
It can take some time for search engines to reflect the changes as they need to crawl and index the pages first. You might be able to speed it up by submitting URLs to the search engines for the duplicates, but you can also simply let them recrawl the pages naturally.
You should also be able to view the effect in Google Search Console under the Coverage menu. Check to see if the list of Valid URLs contains the pages you want indexed and the list of Excluded URLs does not contain valid pages.
If you still don't see any change in crawl patterns via the Search Console after a few weeks, you may need to verify the implementation once again.
3 best practices when using canonical URLs
You can get away with a spelling error or a grammatical imperfection in written text. Readers will still understand your message. It is not the same for coding, however. Make sure your code is 100% correct and that you are using the right URL incorporating your primary domain name.
Let's look at some other best practices for the use of canonical URLs.
1. Use absolute URLs in lowercase
In HTML it is possible to refer to another page via relative or absolute paths.
Absolute path: https://www.domain.com/page/
Relative path: /page/
It is best practice to use the absolute URL with the full path. To avoid any confusion, also maintain lowercase for the URLs. From a technical perspective, uppercase and lowercase characters are different, although most web servers treat them the same. Also, remember to systematically use HTTPS rather than HTTP if you have a secure server certificate. This avoids additional duplicate content issues.
2. Implement canonical URLs on all pages
In theory, you only need the canonical URLs on duplicate pages, but implementing them on all pages is probably easier. It is also considered best practice. The primary page that other pages refer to will hold the rel=canonical instruction indicating its own URL.
3. Avoid multiple canonical tags
Coding multiple canonical tags can happen quite easily, as they can be implemented at various levels. If a canonical URL is indicated in the HTTP header, it shouldn't be mentioned in the <head> section of the page.
More importantly, there shouldn't be two canonical tags on the same page. This will only confuse search engine crawlers and cause them to ignore the statements altogether.
Canonical URLs can never hurt
Not having canonical URLs on a website in and of itself is not an issue. But if your SEO is suffering from duplicate content issues or incomplete crawling, canonical URLs can help fix the problem.
In other cases, it can provide marginal SEO improvement and is therefore considered an SEO best practice. For large or multi-language sites, canonical URLs are an absolute must.
Alert: highest cash back card we've seen now has 0% intro APR until 2024
If you're using the wrong credit or debit card, it could be costing you serious money. Our experts love this top pick, which features a 0% intro APR until 2024, an insane cash back rate of up to 5%, and all somehow for no annual fee.
In fact, this card is so good that our experts even use it personally. Click here to read our full review for free and apply in just 2 minutes.
Our Research Expert
We're firm believers in the Golden Rule, which is why editorial opinions are ours alone and have not been previously reviewed, approved, or endorsed by included advertisers. The Ascent does not cover all offers on the market. Editorial content from The Ascent is separate from The Motley Fool editorial content and is created by a different analyst team.