kyrylkov:
Default configuration of Ultimate SEO may damage your site for at least 2 reasons:
- it makes it possible to create duplicate URL's for the same content, which people say Google doesn't like
I'm SEO guy and all my customers are on the top of Google with ZenCart driven stores. I use this SEO Urls patch and pretty happy.
Actually, duplicate content is just a notice from Google (in webmaster tools panel) - for most cases. The site must be VERY overstuffed the same content for tens, hundreds of pages to get a red flag from Google.
Now I have a customer who have a huge inventory but all product names are pretty useless for SEO. So I pushed this customer to rename all products for SEO purposes. Of course I started to see a growing list of duplicates in Google's Webmaster Tools panel. So, I've just made a quick hack that works only for "wrongname-p-123.html" (most annoying thing). This is a quick hack (sorry, I'm too busy to make a nice patch for all cases, like for categories, etc):
/includes/classes/seo.url.php:
Just find this function (1187 line):
function need_redirect() {
$this->need_redirect = ((preg_match('/main_page=/i', $this->uri)) ? true : false);
and add the following code after $this->need_redirect = ((preg_match('/main_page=/i', $this->uri)) ? true : false); :
// pg@ check product name from URL and redirect if not equal to real product name to avoid duplicates
if ( preg_match('/-p-[0-9]/i', $this->uri) && preg_match('/main_page=product_info/i', $this->real_uri) ) {
$productname_from_url = preg_replace('/-p-[0-9].*/i','',$this->uri);
$productid_from_url= preg_replace('/.*-p-([0-9]+)\.html/i','$1',$this->uri);
if ( $this->get_product_name($productid_from_url) != $productname_from_url ) {
$this->need_redirect = true;
// repeating procedure from function check_redirect() but for real_uri
if ($this->is_attribute_string($this->real_uri)) {
$parsed_url = parse_url($this->real_uri);
$this->uri_parsed = parse_url($parsed_url['scheme']);
$this->uri_parsed['query'] = preg_replace('/products_id=([0-9]+)/', 'products_id=$1:' . $parsed_url['path'], $this->uri_parsed['query']);
} else {
$this->uri_parsed = parse_url($this->real_uri);
}
}
} // pg@
This code compares product name from URL with real product name and if not equal - initiate 301 redirect to the correct URL.
Let me know if it work for you guys.
Equin 0x