Skip to main content

As discussed in the article about duplicate URLs, canonical URLs can be used to set a preferred URL for content that can be reached through multiple URLs. It is one of the methods advised by Google for treating your URLs. 

Joomla 2.5 did not support canonical URL's, but Joomla 3 and 4 do. This should be a good thing, but when you look for the keyword combination Joomla canonical URL, you encounter a lot of blog posts on the forum, discussing the incorrect settings of canonical URLs. Let me explain the concept of canonical URLs a bit more, and possible usage in Joomla

The concept of canonical URLs

Canonical URLs have been introduced by the major search engines in 2009 as a concept to help webmasters fight duplicate content on their own websites. Many CMSs used to have issues with multiple URLs for the same content because of the nature of the CMS. This included Joomla, but also WordPress, Magento, etc. Without canonicals, search engine struggle with which URL to choose for their index. Often, they simply include both (probably diluting the value of both), or the less preferred one. Also, print-views and email-views can be duplicates of the source URL. This can lead to lower rankings. With the new technique, you can now choose the preferred version of the duplicates for this same piece of content. As a real-world example, say you have these 2 URLs on your site:

  • /blog
  • /index.php/blog

You can now choose which one would be the nicest one to appear in the search results (obviously the first one). This happens by adding the following piece of code to your source code:

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

It should at least be implemented in the non-preferred version, but usually, it is implemented in both URLs. Even the preferred URL pointing to itself could be a good thing, as it also prevents URLs with parameters from being indexed as a separate URL. Say you have a site where you can set the font size. In the URL you could see something like this then:

  • /blog?fontsize=small

If the URL already has a canonical pointing to itself (without the parameter), there are no issues with this.

Implementation in Joomla

In Joomla2.5 and earlier, canonical URLs did not exist, so unless you used an extension, you went without them. In Joomla 3, they were introduced though. This solved quite a few issues, like the one in the example above (the one with and without the index.php part in the URL). The implementation is such that all URLs receive a canonical, usually pointing to themselves for correctly found preferred URLs, while non-preferred URLs sometimes point to the preferred ones.

Unfortunately, the implementation is not yet fully correct. This is a work-in-progress feature that might be solved, but there is not a lot of progress on this matter.

Canonical URL for non-SEF URLs

As you may know, even if you have non-SEF URLs switched on, the non-SEF URL is still accessible. So you move to the non-SEF URL for the article with id = 1. This will be accessible like this:

  • /index.php?option=com_content&view=article&id=1

You would hope that the canonical URL for this would point to the SEF version of the article, but this is not implemented yet. It simply has a canonical URL pointing to itself. And there are more cases where canonicals are not yet configured correctly.

Solutions for now

Like often, there are solutions available. Basically. the best solution is to simply use a good extension. The best solution for me is Weeblr's 4SEO. It creates perfect canonicals, both for your SEF URLs, but also for the non-SEF ones, which now correctly point to the corresponding SEF URL. The JED lists a few. There could be some good ones, but I have also come across some that definitely work incorrectly! So make sure to test thoroughly.

Ad - SiteGround Web Hosting - Crafted for easy site management. Amazing Speed; Powerful Tools; Top-rated support. Learn more.