What is a canonical URL?
In a nutshell, A canonical URL is the URL of the best representative page from a group of duplicate pages. Canonical URLs can be useful if a website has multiple pages with similar or identical content and can also help improve a website’s search engine optimisation.
This article will cover these topics:
What is a canonical tag?
Canonical URLs and canonical tags are not the same, but they are often used together. Canonical tags are used to tell search engines which version of a website’s URL is the preferred one. canonical tags are placed in the <head> section of a website’s code.
How to identify canonical URLs on your website?
A canonical URL is typically the version that includes the www subdomain, but it can also be the version without it. For example, if you have a page that can be accessed via both “http://example.com/page” and “http://www.example.com/page”, the canonical URL would be “http://example.com/page”. By specifying a canonical URL, you’re basically telling the search engines which version of the URL should be indexed and to ignore any duplicates.
Common examples of different URLs with duplicate content
- Parameterised URLs for search parameters (e.g., example.com?q=search-term)
- Parameterised URLs for session IDs (e.g., https://example.com?sessionid=3)
- Separate printable versions of pages (e.g., example.com/page and example.com/print/page)
- Multiple URL paths for posts under different categories (e.g., example.com/services/SEO/ and example.com/specials/SEO/)
- Page versions for different device types such as desktop and mobile (e.g., example.com and m.example.com)
- AMP and non-AMP versions of a page (e.g., example.com/page and amp.example/page)
- Non-www and www variants (e.g., https://example.com and https://www.example.com)
- Non-https and https variants (e.g., http://www.example.com and https://www.example.com)
- With and without trailing slashes (e.g., https://example.com/ and http://www.example.com)
- Serving the same content at default versions of the page such as index pages (e.g., https://www.example.com/, https://www.example.com/index.htm, https://www.example.com/index.html, https://www.example.com/index.php, https://www.example.com/default.htm, etc.)
- Serving the same content with and without capital letters (e.g., https://example.com/page/ and http://www.example.com/Page/)
How to implement canonical URLs?
According to Google Search Central, There are a few different ways to set up canonical URLs for your website:
- HTML tag (rel=canonical)
- HTTP header
- 301 redirect*
- Internal links
1. Using rel=”canonical” HTML tags
The most intuitive and common practice to implement canonicals. Simply add the following code to the <head> section of any duplicate page:
<link rel=“canonical” href=“https://example.com/canonical-page/” />
Alternatively, some WordPress plugins like Yoast SEO (seen above) provide features to set up a canonical URL easily from your page editor.
2. Using rel=canonical HTTP header
For documents such as PDF, there is no <head> page, so there is no way to put canonical tags in the page <head> section. In such cases, you should set the canonical using an HTTP header. You can also use canonical in standard web page HTTP headers.
3. Using sitemaps
Google usually sees URLs in sitemaps as canonical URLs, which means any non-canonical URLs are not supposed to be in sitemaps.
4. Using 301 redirects
Setting 301 redirects on the non-canonical URLs pointing to their canonical pages.
- https: example.com
- http: example.com
- https: www.example.com (canonical URL)
5. Using internal links
The better you follow these 5 practices, the more likely Google will understand which pages are canonical URLs on your website. Why bother with all this? Well, if you don’t take steps to control which version of your page is being indexed, you run the risk of having duplicate content on your site, which can hurt your search engine rankings. By setting up canonical URLs, you can make sure that only one version of each page is being indexed, and therefore boost your site’s overall SEO.
Tips for avoiding common mistakes when implementing canonical URLs
Canonicalisation mistakes are surprisingly common. Here are a few tips for avoiding some of the most common mistakes:
Use the correct URL
Make sure that you use the correct format for your URLs. Canonical URLs should always use the https:// protocol and include the www subdomain. For example, https://www.example.com is the correct format for a canonical URL. However, if your website operates on a non-www domain or your www-URLs are no longer accessible (redirected from www. to non-www or else), the canonical URL should be the one you’d like to rank in search results.
Use absolute paths for all of your links
Absolute URLs include the domain name, whilst relative URLs do not. For example, the relative URL for this page is “/canonical-url”, whilst the absolute URL would be “https://digilari.com.au/canonical-url”.
Don’t use parameters in your canonical URLs
Parameters are the parts of a URL that come after the “?” character. For example, the URL for this page includes the parameter “?utm_source=test, however, including parameters in your canonical URL can cause problems with search engines indexing your pages.
Clear up your sitemaps
Don’t forget to remove the non-canonical URLs from your sitemaps! As this article on Google Search Central explains, Google considers all sitemap URLs as canonical URLs. Keeping non-canonical pages (pages with canonical tags pointing at different URLs) in the sitemap sends mixed signals to search engines, which might get confused about which page to rank.
By following these tips, you can avoid common canonicalisation mistakes and ensure that your SEO efforts are successful. If you’re not sure of the current state of your website’s canonical URLs, you can contact our SEO specialists for help. They will be able to assess your website and determine where canonical URLs would be beneficial for your specific situation.
Canonical URLs and tags can be a little confusing, but they’re important for your website’s SEO. So if you’re not already using canonical URLs on your site, I encourage you to start doing so. It’s an SEO technique that can have a big impact on your site’s ranking in SERPs. Luckily, you don’t have to do it alone! We can help you audit your website and make sure these best practices are implemented properly. Book a free website audit with us today and let us help you take your website to the next level!