Canonical Question (Custom Blog Software)

Hey guys,

Its been a while since I posted, and I know just how fantastic this community is, so Im hopeful that someone here will be able to give me some advice with this canonical tag question that I have.

It seems I have a Google indexing issue which is causing me some concern.

Im using custom built blogging software (written in PHP) that posts articles (or pages) in the following format.


Each article uses the same page, just a differnent ID tag. No big deal.


etc etc…

So the following page…


…once rewritten using the URL rewrite method is then displayed as a search friendly URL as such…


Okay thats all fine, however BOTH pages are being indexed.


In an attempt to prevent this, I added the following code to my robots.txt file…

Disallow: /articles_view_article.php?

However that has seemed to only worsen the problem, as Im now finding pages that are showing as “UNTITLED” within Googles index.

These untitled pages point to the same page…

So now it seems I have 3 variations!


My question is this…

If each article or “page” uses the same /articles_view_article.php page then how on earth do I add my canonical tag to each of them to specify their uniqueness?

Any help would be very much appreciated. :slight_smile:


You dynamically add the canonical tag like you do the content.

Makes perfect sense. Ill add an additional field to my CMS and modify the DB to accommodate it.

Thanks !

You can better follow these coding in robots.txt file

User-agent: Googlebot
Disallow: /*?

You can add canonical tag to the url /blog/41/How-to-Ask-For-Help-With-Canonical-Tags-On-Sitepoint.php

I think the above two solves your problem