Opencart Canonicals & Duplicate Content

Canonicals urls are an essential part of avoiding duplicate content in an ecommerce store, and should be added to all pages and products by default.

However, the Opencart CMS doesn’t include any canonical urls for the Homepage or the Category / Sub-category pages, leading to lots of duplicate content issues, and potentially causing issues in your SEO efforts.

I’m going to show you exactly which canonicals you need, and how to easily insert them into your store using a FREE VQMOD file.

What is a canonical url and why do you need one?

Simply put, a canonical link points to the “proper url location” of a page, to avoid Google indexing duplicate page urls, and maintain the link equity of your website.

Examples of Duplicate Content in Opencart

There are plenty of examples in Opencart of duplicate content that can harm your websites Google rankings.

For example if you can visit a product via different routes such as:

  • Homepage -> Category -> Product
  • Homepage -> Category -> Sub-category -> Product
  • Homepage -> Product

These urls will all have different url paths:


When Google crawls your website, it follows all of these variations, and so each of these links will be crawled, and counted as a different page.

Duplicate Content And Google Panda Penalties

Google HATES duplicate content with a passion, particularly duplicate content on the same website.

They have an algorithm dedicated to penalising websites for this, called Panda, which is notorious for not just harming the pages with duplicate content, but bringing the entire websites rankings down.

Fix Duplicates with a Canonical Link

Luckily there is a fantastic way to tell Google that each of these pages are the same, and then tell them which one you would like to count as the “proper location”.

That’s called a canonical link, and it looks like this:

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

In our example, if this was added to the product page as a canonical link, then it tells Google that the Homepage -> Product version of this url is the only one that should be indexed.

This fixes the duplicate content, as Google only indexes one version of the page, keeping all of your indexed content unique, and resulting in higher rankings.

Stop Losing Link Equity With Canonicals

Canonicals also prevent you from spreading your link equity too thinly over your website. For example if someone links to these two pages:


Then without a canonical url, you will have one link to each page, and two competing pages that can cause keyword cannibalisation.

With a canonical url, the link pointing to the non-canonical version of the page will be counted towards the rankings of your main page, helping it rank even better in Google for its target keywords.

How to Add a Canonical Link to Your Opencart Homepage

The homepage of your online store is the single most important page from an SEO perspective.

It will normally have the greatest amount of inbound links, and contain internal links to your other most important pages, spreading the authority to the rest of your website.

So what’s the problem?

Without a canonical, multiple variations of the homepage url can be indexed in Google, urls such as:


These will all display the same page (your homepage), but because they are separate urls Google treats them as unique pages.

The Code To Add a Homepage Canonical in Opencart

You will need to edit one of your website files via FTP or file manager to do this. Alternatively for a better way to implement it, you can use the FREE VQMOD file at the end of this guide.

First navigate to: catalog/controller/common/ and open the file home.php.

Next you will want to find the line:


And below it, add the following code:

$this->document->addLink('', 'canonical');

You will need to replace the example url with the homepage url of your Opencart store.

How to Add a Canonical Link to Your Opencart Category Pages

How to add category canonical links in opencart

As mentioned above, your category pages require canonicals to ensure no duplicate paths are indexed, and to maintain your link equity.

This is a particular problem with category pages that contain product filters, as they often create new urls when you choose a filter.

For example when you filter the product list by Price Low > High in Opencart the url looks like this:

Without a canonical, this will index as a new url, and cause a Google Panda penalty from duplicate content as mentioned previously

The Code for an Opencart Category Canonical

It’s quite simple to add this code to the category controller, and produce your own category canonical links. HOWEVER, if you would rather have the simple and FREE version of doing it, see the free VQMOD file attached at the end of this post.

Via FTP, visit this location in your store: catalog/controller/product/ and open the file category.php.

Find the following line of code:


And below it add this code:

$this->document->addLink($this->url->link('product/category', "path=".$this->request->get['path']), 'canonical');

This will produce the canonicals on every category and sub-category page.

Free Vqmod To Insert Homepage & Category Canonicals

Here is your free SEO loophole, a VQMOD file that automatically inserts the canonical for the homepage url, and your category urls.

Simply like or subscribe to gain access to the file below.

Matt Jackson

Digital marketer, specialising in e-commerce SEO, including audits and strategy. Director of JP Digital Enterprises.

This Post Has 12 Comments
  1. Hi Matt, good article. But i have found another bug.

    I see opencart demo of a subcategory on this page

    The canonical is correct. But if i delete 25 and i write it
    i can see the same page (duplicate content) and a different canonical.

    It’s possible to solve it? I think that to be sure 100% we need to solve it, right?
    Thanks so much !!!

    1. Hi Antonio, I’ve checked the demo urls you’ve pasted and they both have the same canonical url:

      This means that Google won’t treat them as duplicate content.

      All the best.


  2. Hi Matt,

    Wah thanks it’s worked in opencart v1.7. Many Thanks.

    But when I try in opencart 2.2 it’s not worked. Any suggestion ?


  3. Hello!
    I think about to add in canonical for pagination link to page with all products of current category. Some link like Show all. But, I did not find the way how to do it.
    I thought about something like this
    But I am not sure.
    Maybe you did it or can help me to find better method?
    Thank in advance.

    1. Hi Anna,

      The ideal solution is to set all pagination pages (page 2, 3, etc) to noindex, follow.

      This means that Google will read the content (links to products, etc) but it will not index the pages.

      To do this in Opencart, I think you need to do some custom coding, a temporary solution would be to block the pagination in the robots.txt file such as:

      Disallow: /*&sort
      Disallow: /*&limit
      Disallow: /*?limit=

      But in the long term it’s better to have them crawled but not indexed.

      I’ll have a look for a plugin that works for this and get back to you.

      All the best.


  4. Hello will i see a big difference in the ranking?
    I guess i have to get better ranking just by ading this.
    I mean it was even confusing for me the way opencart handles url’s

    1. It’s all relative to how many problems you have, the quality of your site, etc. But I would definitely expect to see a rankings improvement from fixing duplicate content problems on any website.

  5. Hi Matt, im wondering does the opencart have default canonical links implemented already? I think it does, except for the homepage if im not mistaken. Can you confirm this?


Leave a Reply

Your email address will not be published. Required fields are marked *