How to Add Canonical Tags in Website

If you failed the canonical tags test, do not panic. But this does require a bit of explanation if you have no idea what these are. Failing this test means most likely that you have got some similar content like maybe some similar pages that you are split testing, different URLs for different variations in a similar product or you’ve got the same content on multiple URLs and so on.

The search engines are indexing them as such as different pages. Generally this is not a good thing since duplicate content hurts your SEO efforts. Generally you want to rank as high as possible for certain content and keywords. Not necessarily get all of your content ranked. So in some cases it is a much better idea to have this same or similar content count as the same page.

[bs-quote style=”default” quote=”Great things in business are never done by one person. They are done by a team of people.” author_name=”Steve Jobs” author_job=”Apple co-founder” author_avatar=”” align=”left” ]

As far as these search engines are concerned even if the URLs for these pages are different. Wait what how can we do that? That is exactly what canonical tags are all about. For instance let’s say I’ve got my main index page here. This is my quote-unquote real website with almost all of my advertisement efforts and almost all of my traffic coming from major cities in the US. Things are going very well with business. I am happy for me but in trying to expand my online business and reach new markets. I am also doing some split testing in a few major Canadian cities.


Now the ads I run are one thing. Basically carbon copies of my ads for the US market this is not an issue but I have got them hyperlinked to a slightly different URLs. 99% the same as my index page only this one is slightly catering to the Canadian market. Really just a word or two is changed in the text I have got the good old maple leaf flag instead of Stars and Stripes and that’s it. Very minor changes that this is exactly what I want in terms of marketing.

Copyright Content Issue

The problem is that Google and other search engines are likely going to nail me for having duplicate content here. They are going to say wait a minute, this page is practically identical. Look at all the similarities here. So what is with the two URLs? This dude here is trying to trick us into thinking he is got more content that he actually has. He is keyword stuffing; he’s trying to rig the page signal game. We are on to him. Let’s dock him some points well for me I’m doing nothing wrong here but I am getting punished for it.


Another example let’s say that I sell custom designed t-shirts on my ecommerce site. I have got hundreds of the things and customers can not only choose the design they want but obviously the size and even the shirt style. So I have got hundreds of individual pages with absolute heaps of the same content, the text descriptions, and the buttons and so on each with a unique URL and to make matters potentially worse for my SEO. Yet better for navigation purposes. I have also got a lot of this content duplicated in different categories, like shirts for men and women for instance. That is double the amount of URLs yikes or same goes if I have got a blog that I have been writing for years. Lots of terrific content, hundreds of articles, thousands of blog posts conveniently divided across multiple pages to help my users navigate through this massive library of content. I have divided content like this is known as pagination. Now in this case I’d like my blog to rank as high as possible but I am certainly not trying to land all 326 of my URLs in the top 10 of the SERPs. I am just trying to land my homepage so in all of these three scenarios I want to do two simple things.

One I want to avoid being penalized for duplicate content.

Two I want to tell the search engines to please spend all the link juice that I am squeezing out of my site and apply it to a certain page and voila. That is exactly when canonical tags come to the rescue. It is a way to tell the search engines that everything’s aboveboard here can you please not treat this as duplicate content but instead can we take any positive PageRank signal that this page is getting and apply it to this page.

Ways to Harness the power of the Canonical Tag

Let’s look at a few ways to harness the power of the canonical tag. One option is to add this tag inside the header of each page that you want the search engines to look past so to speak in this context that we’ve been talking about and point that tag to the page that you do want ranked. Now of course if you have thousands of pages that you want to leave behind in the SERPs then this could get pretty tedious. It is a solid way to guarantee that you are not going to get penalized for duplicate content or other issues on pages that carry this tag in the head that is HTML pages. This method is not going to work for things like PDF files.

Add Canonical tag in an HTTP header


In those cases and another method we can use is to add the canonical tag in an HTTP header or your page response. Since files like PDF’s do not have HTML headers. We cannot very well add canonical links in there. In those cases we’ll need to implement them another way. In those cases we can add a snippet of code to our .htaccess file. If we are using PHP then we can add a header before any HTML output which will add the canonical link before it gets sent. If you are using, you can add a header like this.


When you are done just be sure to submit your URL to Google search console so that it will get your canonical URL crawled.

Add Canonical Tag through Sitemap


One last method to add the canonical tag is through your sitemap. Just specify your canonical URLs there save and submit that new sitemap to Google and other search engine consoles. But for the record search engines will still have to crawl the content and understand what duplicate content might be there and this is generally the weakest approach in terms of getting the search engines to understand what you are doing.

The other methods that we’ve just covered or better but that said the sitemap method isn’t completely ineffective and it is obviously much easier especially if you’ve got this gigantic site with lots of pages in that case then about 30 seconds of work and boom. You are done compared to editing all those different pages and adding tags in the head section. Just saying might be a good enough option depending on your circumstances. Feel free to leave your reviews in comment section.

Leave a Reply

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