Canonicalisation and Zend
Posted on | March 12, 2012 | No Comments
Canonicalisation issues occur when a webpage is able to be accessed via both www.yoursite.com/somepage and www.yoursite.com/somepage/, in severe cases this can cause the search engines to effectively index 2 identical copies of your site. Zend routes do not discriminate between pages that end in a slash or not – if a route does end in a slash, then the route removes it. Using a complex regex route it is possible to go to the correct version of the page (either keeping the slash or omitting it), however it is easier to use a canonical tag instead.
Include this line in the head tag of your layout file:
[php]
echo '';
[/php]
$this->url() will return the current url with corresponding parameters.
If you have a route ‘/products/:category’ and the user visits ‘/products/some-category/’ then the canonical tag will be generated as:
[html]
[/html]
Posted By:Richard Parnaby-King