Skip to content

Canonical URL for Mambo

Last month, Google, Ask.com, Microsoft Live Search and Yahoo! launched a new tag format that allows you to specify your preferred version of a URL. This new meta tag tells these search engines which URL they should use as the canonical URL for the content, regardless of what session id, link parameter or other variable has been appended to the end of the URL. This is hugely beneficial to Mambo (and other dynamic CMS) users because it enables us to avoid duplicate content penalties.

One of the biggest culprits for causing duplicate content in Mambo is the frontpage component. Depending on the server settings, most sites can be accessed through:

  • http://example.com
  • http://example.com/
  • http://example.com/index.html or http://example.com/index.php
  • and sometimes also with both www and without it!

Mambo frontpages can be accessed through most of those as well, but also have additional URL's to contend with:

  • http://example.com/mos/Frontpage/Itemid,1/ (with built-in SEF URL's enabled)
  • http://example.com/index.php?option=com_frontpage&Itemid=1 (without SEF URL's enabled)

So, you can see that there is a lot of potential for duplicate content. The new search engine tag takes care of this. By setting the new tag in the head section of your template's index.php you can specify which URL you want to be used as the canonical URL - the authoritative URL for your frontpage.

To do this, simply add the following code above the closing </head> tag in your template's index.php file:

<?php if ($option == "com_frontpage") {
      echo '<link rel="canonical" href="'.$mosConfig_live_site.'/"/>'."\n"; 
 } ?>

The canonical URL is important for two reasons - firstly, to avoid duplicate content problems, and secondly, to avoid dilution of your page rank. If the frontpage can be accessed through many different URL's then other sites can link to it in many different ways. This spreads the page rank across the URL's as search engines treat each one as a different page, even though the content is the same. The new tag will consolidate all link popularity back to the URL you set as being the URL for the original content. It will also ensure that this URL is the one that is seen in search results.

Read More about canonical URL's and duplicate content in these articles:

This new canonical tag is the single-most important change to search engine optimisation in a very long time.
Do you have other SEO tips for Mambo?

If you enjoyed this post, make sure you subscribe to my RSS feed!

Topic: Mambo Tutorials
Tagged as: canonical url, canonicalization, Google, links, Microsoft, SEF, SEO, templates, Yahoo!

Share on FriendFeed

{ 3 comments… read them below or jump to the comment form to add your thoughts }

  1. 1 Kaponne September 25th, 2009 at 1:47 am

    Thank you very much for this post Elpie..this is grate..i was looking all over the internet for this piece of code...u made my day...cheers from romania ;)

  2. 2 Lynne Pope October 3rd, 2009 at 1:57 am Lynne Pope

    @Kaponne: I'm glad you found it useful Kaponne :-)

  3. 3 David February 21st, 2010 at 7:14 am

    Thanks a bundle from Ottawa, Canada, this is a great help!

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Any comments that look like spam will be treated as spam - this includes SEO titles and use of spurious keywords.

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.