Welcome to WebmasterWorld Guest from 23.22.182.29

Message Too Old, No Replies

Rel canonical pointing to itself

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

New User

5+ Year Member

joined:Feb 9, 2009
posts: 15
votes: 0


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 Sept 23, 2009 (gmt 0)

Senior Member

joined:Jan 27, 2003
posts:2534
votes: 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 Sept 23, 2009 (gmt 0)

New User

5+ Year Member

joined:Feb 9, 2009
posts:15
votes: 0


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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 9, 2005
posts:1509
votes: 0


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 Sept 23, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 17, 2004
posts:1354
votes: 0


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