Skip to Main Content

SEO Geek: rel=canonical for HTTP Headers

Posted on 7.12.2011

Several weeks ago Google announced support for link rel="canonical" relationships specified in HTTP headers as per the syntax described in section 5 of IETF RFC 5988. 

Editors Note: As a quick aside, Website Magazine will feature a very practical article from Prashant Puri on canonicalization in the Small Business Lab column of our September issue. 

Webmasters can use rel="canonical" HTTP headers to signal the canonical URL for both HTML documents and other types of content such as PDF files. For example, perhaps you have a white paper as an HTML page and as a PDF using two URLs - and SEO's can signal to Google that the canonical URL for the PDF download is the HTML document by using a rel="canonical" HTTP header when the PDF file is requested.

So how do you apply it?
If you’re using, Classic ASP or PHP web pages, here’s how:

ASP.Net C#:
; rel=”"canonical”"”);%>

ASP VBScript:
; rel=”"canonical”"”%>


; rel=\”canonical\”");?>

When the web page is requested the server will respond with a 200 status as well as the link header telling Google that the page is a canonical of the URL specified.

Google provided another instance when this might come in handy. For example, serving the same file from multiple URLs (common if using a content distribution/delivery network). The rel=canonical HTTP header could be used to signal to Google the preferred URL. 


Today's Top Picks for Our Readers:
Recommended by Recommended by NetLine

Leave Your Comment

Login to Comment

Become a Member

Not already a part of our community?
Sign up to participate in the discussion. It's free and quick.

Sign Up


Leave a comment
    Load more comments
    New code