Sitepoint Members,
How Do You Specify a Canonical Link in Your HTTP Header? The only headers I know how to set are in the htaccess file and they apply to all pages. Does it mean place a link tag in the head of each page?
Google uses this as an example
Link: <http://www.example.com/downloads/white-paper.pdf>; rel=“canonical”
(https://support.google.com/webmasters/answer/139066?hl=en#2)
but doesn’t say where it should be placed. Also is that the format? Isn’t it supposed to closed in some way?
Thanks,
Chris77
Try this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>Testing</title>
<link rel="canonical" href="http://blog.example.com/dresses/green-dresses-are-awesome" />
</head>
<body>
<h1>Title</h1>
</body>
</html>
The URL requires changing to your site.
Yes a canonical link is required on the page where there are two pages with similar content such as the following:
“http://blog.example.com/dresses/green-dresses-are-awesome”
“http://blog.example.com/dresses/red-dresses-are-awesome”
“http://blog.example.com/dresses/blue-dresses-are-awesome”
because the pages will most likely have identical except for the colours. Pick any colour then have each page with the chosen colour to prevent duplicate titles, content and data.
Upload to your site then use Google Webmasters Tools to check to ensure it is OK.
So there are headers, as in expires headers, and lines of code within the <head> are also called headers?
I think expire header will overide the htaccess header. Maybe anything in between the head is called headers.
Any other knowledgeable members like to help?