Search Engine Optimization & Performance tuning for your Joomla website

Joomla 3 and canonical URL

Update 18/12/2013: The bug discussed here is fixed in Joomla 3.2.1, so no longer applies.

As discussed in the article about duplicate URL's, canonical URL's can be used to set a preferred URL for content that can be reached through multiple URL's. It is one of the methods advised by Google for treating your URL's. Joomla 2.5 did not support canonical URL's, but Joomla 3 does. This should be a good thing, but when you look for the keyword combination "Joomla 3 canonical URL", you encounter a lot of blogposts on the forum, discussing incorrect setting of canonical URL's. Actually, recently I stumpled upon an issue myself where it seems the feature is not implemented correctly in Joomla 3 (Joomla 3.2 at the time of writing). 

Want to support this site? Buy my E-book: Joomla 3.5 SEO & Performance!

The issue happened on a site where the homepage was set-up as a list of featured articles. Now I happened to be looking at my site using the SEO-Doctor Firefox plugin, which immediately started screaming that the page is not indexable!

When I checked the source code, it showed me a really funny canonical URL, while the actual URL is "http://localhost/joomla3":

<link href="http://localhost/joomla3/?view=featured" rel="canonical" />

What this page will tell Google is: don't index the homepage, but index the page with "?view=featured" ....

I did a few checks, and I could easily reproduce the issue on a few sites, so it seems structural. I also noticed some other strange behaviour lately. 

Say you have a menu-item linked to a blog-view for a category. If you select one of the articles, you may go to the URL ..../blog/article1. The canonical URL is this same URL. which is fine. However, if you take the corresponding non-SEF URL for the same article (you can check the non-SEF URL when linking to the article in JCE-editor), the canonical URL will lead you elsewhere.

So, as long as you have a simple site with menu-items linked to single articles, you will probably not suffer, but on sites with more complex views, it might be good to be aware of the issue.


  • One option is to prevent Joomla from creating canonical URL's, by creating am override for the file /plugins/system/sef/sef.php on line 51 (better no canonical then an incorrect one)
  • If it just concerns one or two pages on the whole site, you could consider using NoNumber's ReReplacer plugin to set the correct tag
  • Install a plugin or extension. The major SEF extensions all set a canonical URL, but recently a really small plugin has been publised which seems to do just what we need here, the Canonical plugin by Styleware

Joomla 3 is still in progress, so let's hope these problems will be fixed in 3.5 and we don't need these fixes.

Like this article?    Share it!