Dynamic Cross-Domain Canonical URL’s with PHP

Google announced support for specifying a canonical representation of content back in Feb of 2009. This was done in order to help webmasters avoid duplicate content in their sites by specifying the rel=”canonical” link element in the head section of duplicate pages. In December of 2009, Google announced the ability to implement the canonical tag cross-domain. This is particularly helpful for webmasters who have mulitple domain names pointing at the same content and cannot implement 301 redirects on their servers.

If you have a dynamic site, editing the head of each document individually is not possible. In thisĀ  situation you can utilize the Apache REQUEST_URI server variable in PHP to create the canonical link element dynamically. The example code is below:

<link rel="canonical" href="http://www.domain.com<?php echo htmlspecialchars($_SERVER['REQUEST_URI']) ?>" />

In this example, you would put the code snippet in the head area of your dynamic page(s) on your other domains ie. domain.net and domain.org. This tells the search engines that no matter what the path or page is on those domains, the canonical location of that page is located on domain.com.

Getting Rid of Yahoo in 2008

One of my new years resolutions is to free myself from using ANY Yahoo! products and services in 2008.

Why? Yahoo! Mail is now almost unusable due to the fact that their spam filtering has become so poor. YSM (Yahoo Search Marketing) continues to suck and not deliver ROI (at least in my experience). And of course, YPN (Yahoo Publisher Network) is a complete flop, with piss poor targetting of ads. On top of all of that, I am starting to get random spam on my Yahoo Messenger account on a regular basis.

And to top it off, Yahoo! search results flat out suck. They are certainly slipping into the # 3 search engine in my book behind MSN/Live.

See ya Yahoo!