Canonical URL issues can create problems for your website, mostly for search engines but also occasionally your visitors. Let’s simplify this concept by first offering up a canonical URL definition and give an example. Then we’ll cover how to see if you have any canonical URL errors on your site and how to fix them.
Canonical URL Definition
A canonical URL is the main/master or original version of a URL. Or, to put it another way, this is your intended URL for a given piece of content.
A canonical URL is the URL which you want search engines to index in regards to a specific page of content on your site.
You don’t want multiple URLs with the same content on your site for a few reasons.
One, it forces Google to make its own decision as to which page to index. The version which is indexed might not be the one that you want. It also makes Google have to crawl more pages needlessly on your site. This increases the chances that it will miss a page which you actually want to be indexed.
If you have multiple instances of the same content, it means that potentially any links made to that content could be sent to the wrong instance. At the very least, unless every link goes to the page you want to rank, you’re splitting that link juice up so that it’s not as effective.
Canonical URL Example
The most obvious canonical URL example is a website’s home page.
This site’s home page is located at AngrySEOer.com. But think of all of the different URLs that exact same content can load as:
- https://www.angryseoer.com
- http://www.angryseoer.com
- https://angryseoer.com
- https://angryseoer.com
All FOUR of these URLs will load the same content.
Note that in this site’s case, every single one of those URLs loads to the canonical URL of https://www.angryseoer.com. I’ll talk about how to do this on your site in a moment.
There are more common canonical URL examples. I’ll break them down by type and offer a solution to each in a moment, but first let’s talk about how to find canonical URL issues.
How to Find Canonical URL Issues
There are a few ways of how to find canonical URL issues on your site.
Search Google
One option is to search your site via Google.
Use the search operator in Google: “site:yoursite.com”
Obviously swap out yoursite.com for whatever your URL is. This will give you a list of every page Google has indexed on your site.
Sitemap
You can also check your sitemap. If you haven’t made one yet, you can do so using my guide in how to create a sitemap for your website.
Then go to the URL extension for that sitemap. Typically it’s yoursite.com/sitemap_index.xml.
This gives you a rundown of all the URLs on your site, broken up by type:
Clicking on any of those links shows every URL of that type. You can see if there are any similar URLs which is a good indicator of duplicate versions of the same content.
3rd Party Tool
You can also use a 3rd party tool to run a site audit. Moz, Ahrefs, SEMrush all have premium audit tools to help identify canonical issues.
How to Fix Canonical Issues
The best way to identify how to fix canonical issues is to breakdown each type. Here are the most common issues and how to fix them.
HTTPS/HTTP or WWW/non-WWW
Any page which can load as both HTTP or HTTPS or WWW or non-WWW is a potential for problems. Creating a simple 301 redirect in your htaccess file can solve a lot of the most common canonical URL issues.
Simply add this code to its own section of your htaccess file:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
The will force browsers to load the “https://www.” version of your site.
Note that you need an SSL certificate otherwise your browsers can’t properly load the HTTPS version (see SSL certificate how to get one). I mention a plugin in that tutorial which simplifies the process. The plugin will even create a 301 redirect automatically for your in your htaccess file.
URL Slug is Changed After Publishing Page/Article
It’s a good idea to make sure you have your URL slug how you want it when you create a new page or article. The best permalink structure is “post-name” as it’s clean and reflects the title of the page. This makes it good for visitors and search engines alike.
If you decide that you want to change the URL after you’ve published the page, you can change it in WordPress. Now in my experience, WordPress automatically redirects to the updated URL when you try going to the older one. The same effect applies to links.
Some webmasters claim that WordPress doesn’t do this for them, resulting in a dead link. You can use the free and tested Redirection plugin for WordPress to specify a redirect from the old URL to the new one if you have any issues.
Search Operator Created URLs
If you have a complex search bar on your site, it can serve up an infinite number of URLs showing the same content. This is the case on e-commerce sites where customers can arrive at a product’s page via a search engine which adds query information to the URL of the page.
In this case, you can simply designate the canonical URL using Yoast – a free SEO plugin.
At the bottom of the “advanced” section of the plugin on every page or post of content on your site, you can designate the canonical URL.
It’s a good habit to get into to specify the pending URL of the page itself here whenever creating a new page of content in general.
That way, Google instantly recognizes that this is the original and main page for that content, thus nipping any canonical URL issues in the bud from the start.
Syndicated Content
If you publish content from your site on other content sites this can create a duplicate content issue. As advanced as Google is, it may not be able to tell who the original author or source was.
In this case you want to specify that the page on your site is the canonical URL. Like in the last example, you can use the same plugin method to designate this.
Also in this case, make sure that the other sites which feature that same content specify your URL as the canonical instance.
Mobile and Desktop Versions of the Same Content
Some webmasters create a dedicated version of their website which is optimized for mobile users. In this case, you’ll have the exact same content spread across two unique URLs: one mobile and one desktop.
Again, you’ll want to choose one to be the canonical version and designate it on both instances of the page.
In summation, make sure that you designate the canonical version of the URL every time you create a new page or post. Getting in the habit of doing this with a new piece of content can nip a lot of potential issues in the bud early on.
Pingback: NoIndex SEO - Which Pages Should You NoIndex? - Angry SEOer