The Search Ninja

Canonical URL Links for Zen Cart

February 13th, 2009 . by admin


Canonical URL SolutionGoogle’s announcement that they have (along with Yahoo! and Microsoft) adopted the canonical attribute for link tags 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).

BAM!!!! Don’t say the Ninja never did anything for ya.

One Response to “Canonical URL Links for Zen Cart”


  1. […] I found this that may be of use: Canonical URL Links for Zen Cart | The Search Ninja It is designed to tell SEs that a page should be cosidered the same as another page. […]

Leave a Reply

You must be logged in to post a comment.