Google

Monday, March 9, 2009

Canonical URL Links' SEO for Zen Cart

Canonical URL Links support a format that allows you to publicly specify your preferred version of a URL. If your site has identical or vastly similar content that's accessible through multiple URLs, this format provides you with more control over the URL returned in search results. It also helps to make sure that properties such as link popularity are consolidated to your preferred version.

Google’s announcement that they have (along with Yahoo! and Microsoft) adopted this canonical attribute for link tags, this is great news for SEO’s. This special attribute is great tool for resolving duplicate content issues within a given website.In the last 24hrs.

I have seen several plugins and code snippets appear which will allow webmasters to take advantage of the canonical url attribute within various open source CMS platforms. I didn’t however see anything for use in Zen Cart that struck my fancy. Since Zen Cart is my preferred shopping cart system I decided to write a simple PHP script(let) so that my Zen Carts could take advantage of the canonical attribute.

The following code is easily implemented, and may be freely distributed and used (at your own risk of course).

The Code:

<!– Begin SE Canonical –>
<link rel=”canonical” href= <?php
$original_url = HTTP_SERVER . $_SERVER[’REQUEST_URI’];
$split_url = explode(’?', $original_url);
$no_querystring_url = $split_url[0];
echo $no_querystring_url; ?> />
<!– End SE Canonical –>

The Install

Simply copy and paste the script right after the closing title tag (</title>) of your html_header.php file (located in your Common folder of your custom template folder in your Zen Cart installation).

No comments: