How To Implement rel=”canonical” HTTP Headers

Google recently announced their support for rel=canonical HTTP headers. This can come in handy if you see duplication of content across different file types.

It allows webmasters to assign a file a tag that references an HTML document as the real (canonical) URL. This tag will come in hand for any website that currently offers the information on their HTML web pages as a downloadable PDF. For instance, a holiday company may be offering information on Australian holidays as both an HTML page and as a downloadable brochure in PDF format:

http://www.yoursite.com/australian-holidays.html

http://www.yoursite.com/australian-holidays.pdf

In this instance, with both files serving up the same content, a sever-side canonical tag could be applied.

All very well and good, but how do you apply it? If youre using ASP.net, Classic ASP or PHP web pages, heres how:

ASP.Net C#:

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

ASP VBScript:

<%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.

About the Author: Alex Harvey

Alex works for Fresh Egg, an SEO and multi discipline search agency. He has an extensive background as a web developer.

SEO & Web Design Blog

Additional Posts

"Will Google+ Succeed" Is Simply The Wrong Question

7 Reasons to Worship Your WebMaster or Webmistress

Product review

Private Label Rights (PLR) Content – More Than Articles and Ebooks

In compliance with Ontario’s non-essential business closure our physical offices are closed until further notice. Fortunately our willingness to adopt work from home and the required technology over the past two years has allowed us to continue our operations without impact. For our valued clients and partners you can expect the same great level of service and execution you have become accustomed to.

Many clients/prospects have reached out to us in an effort to introduce new campaigns as quickly as possible. In an effort to help our clients pivot we have increased our campaign build capacity. We are now able to turn new campaigns over in 2-3 business days opposed to the typical 5-7 business day turnaround time. Please note that campaign launch approvals from the vendor side (Google, Bing, Facebook, Instagram etc.) may be delayed as those companies migrate to work from home.

For existing clients please reach out to your account manager with any questions you may have.

For non-clients looking for assistance with new campaigns please Contact Us

Read previous post:
"Will Google+ Succeed" Is Simply The Wrong Question

Why asking will it succeed is not just the wrong question but a bad question....Read More...

Close