Jump to content

Canonical URL in v.1.4


Recommended Posts

Is the canonical module OK in v.1.4 ?

Because, I have enabled it, but when I enter my site, there is a canonical tag to www.mysite.com.

When I get into category, there is a canonical tag with the url to the category.

When I make sorting of products, there is a canonical tag with the url, which is in the browser url tag. I think, it should be the url to the category site...

Where can by the problem ? I am using v.1.4. stable.

Link to comment
Share on other sites

  • 2 weeks later...

The Canonical module in PrestaShop never works well. The author does not understand what Canonical URL is and how should be used. Using default canonical module can produce more bad results for search engines. It recomended never install this module. In 1.4 was removed by default.

Link to comment
Share on other sites

  • 4 months later...

Hi,

 

I made a small fix to canonical URL original from PrestaShop.

 

I dont think it will work on every pages or products, but it works on most common webstores with seo links available.

 

In Canonicalurl v 1,3 around line 75 you find:

 

$ps_request = str_replace(__PS_BASE_URI__, '', $_SERVER['REQUEST_URI']);

 

After that, replace everything with the following code:

 

$server_req = strstr( $_SERVER['REQUEST_URI'], '?', TRUE );
 if (strlen(Configuration::get('CANONICAL_URL')) > 0)
  $smarty->assign('canonical_url', $protocol_link.$canonicalUrl.$server_req);
 return $this->display(__FILE__, 'canonicalurl.tpl');
}
}
?>

 

What this mod do?

 

Well it takes off everything after the symbol ?. For example the second page of category, or order options are followed by ?.

 

Or think you are selling shoes and your red shoe link is: http://mystore.com/shoes/red-shoe.html after that we put: http://mystore.com/shoes/red-shoe.html?better_to_buy_on_ZAPPOS, the old canonical print exactly this URL wich tells search engine that this is the original content, now, with this mod, it tells search engine that original page is http://mystore.com/shoes/red-shoe.html

 

Hope that helps

 

Regards

 

Mozack

  • Like 1
Link to comment
Share on other sites

Hi,

 

A small mod need to be done because an issue when link ends with another symbol different of ?.

 

find:

 

$ps_request = str_replace(__PS_BASE_URI__, '', $_SERVER['REQUEST_URI']);

 

After that replace all code with:

 

$symbol_array = array('$','?','&','#');

 if(in_array($symbol_array, $_SERVER['REQUEST_URI'])) {
  $server_req = strstr( $_SERVER['REQUEST_URI'], $symbol_array, TRUE );
 }
 else {
  $server_req = $_SERVER['REQUEST_URI'];
 }
 if (strlen(Configuration::get('CANONICAL_URL')) > 0)
  $smarty->assign('canonical_url', $protocol_link.$canonicalUrl.$server_req);
 return $this->display(__FILE__, 'canonicalurl.tpl');
}
}
?>

 

You can now place the symbols you want in variable $symbol_array

 

Thanks

 

Mozack

Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...

Will this work with the latest version?

 

Is it the same as a duplicate content module?

 

Yes, will work on the latest version of PS.

It's not the same as duplicate content module, this will remove some parameters (ex. the sort parameters) from the url.

Link to comment
Share on other sites

  • 4 months later...

I am also facing the same problem and in the webmaster account i have got 256 count by Google as duplicate content and title tag.. can u help me on this . is there any free module for it or where can i find the location of the main default module < the location of the default cannonical module tag in the prestashop directory >to edit it...

Plz help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...