Welcome to WebmasterWorld Guest from 54.167.157.247

Message Too Old, No Replies

Rel canonical pointing to itself

   
5:48 am on Sep 23, 2009 (gmt 0)

5+ Year Member



Hello.

I have a small question that I can't get an answer to.
I assume everybody heard about rel canonical,.. ok.

So my issue is..
I have Page A, and Page B.
I have to put a rel canonical tag on Page B, so that it points to Page A.

However, since it is the exact same page(dynamic content), if I put a rel canonical tag on Page B, it also appears on page A.

So basically, Page A is also pointing to Page A.

Did anybody had the same issue?..
It is ok for the canonical page to have a 'link rel="canonical"' pointing to itself?

Thank you very much !

8:12 am on Sep 23, 2009 (gmt 0)



There's no problem with having a canonical attribute referencing the current URL. This is expected behaviour on many sites
8:21 am on Sep 23, 2009 (gmt 0)

5+ Year Member



Thanks for the quick reply. Greatly appreciated!
9:10 am on Sep 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why can't you just find the requested URI and turn it off or on?
In PHP it could look something like this:

if(strstr($_SERVER['REQUEST_URI'],"PageB.html")) {
$AddTheRel="<rel link here>";
}

OR if you are using Query_Strings, maybe like this:

if(strstr($_SERVER['QUERY_STRING'],"PageB")) {
$AddTheRel="<rel link here>";
}

ADDED:
Sorry if I sound blunt, it's late here. =)

11:20 am on Sep 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's no problem with doing that at-all.