SEO Geek: rel=canonical for HTTP Headers

Posted on

  • email
  • twitter
  • facebook
  • share this

share this



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 - example.com/white-paper.html and example.com/white-paper.pdf. 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 ASP.net, Classic ASP or PHP web pages, here’s how:

ASP.Net C#:
<%Response.AddHeader(@”Link”,@”< http://www.yoursite.com/>; rel=”"canonical”"”);%>

ASP BLOCKED SCRIPT
<%Response.AddHeader “Link”,”< http://www.yoursite.com/>; rel=”"canonical”"”%>

PHP:

<?php header(“Link: <http://www.yoursite.com/>; 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. 

 

Filed under: , ,

 
     :: Try iContact for FREE for 30 Days! Sign up now at iContact.com ::


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

Be the first to comment on this article

999 E Touhy Ave
Des Plaines, IL 60018

Toll Free: 1.800.817.1518
International: 1.773.628.2779
Fax: 1.773.272.0920
Email: info@websitemagazine.com

Facebook


Twitter