SEO Duplicate Content Bug Fix for V2

There is a major issue which has existed since at least V2. One of my stores recently received a Google Penalty because 40% of the site was duplicate content with no canonical tags due to this issue. The Penalty has subsequently been lifted.



Please note I have looked throughout the forum and looked at store owners and even developers own CS-Cart V2.2.X stores and found this issue exists and that they have duplicate content. In quite a few cases, the product pages were ranking well, but the category/subcategory pages were ranking very poorly, probably due to the nature of the duplicate content resulting in a -30 or -40 penalty.



The problem being the pagination SEO URL for category pages is generated even if it is not required. For instance, if you have in Settings>Appearance>“Products per page” a value of '25', once a category page is required to show more than 25 products, a second page should be generated, the URL's of which will be something like so:-


http://www.domain.com/category-name/

http://www.domain.com/category-name/page-2/



This is fine. There's even a few “Canonical URL” addons available for 3rd parties which generate the correct canonical tags for these URL's. This is correct practise only if the page content actually changes between page 1, page 2, etc, however, none of these 3rd party addons resolve this issue…



If you do not show products on the category page - ie. if Settings>General>“Show products from subcategories of the selected category” is unchecked - you will likely still have the problem.



To see the true effect, complete a Google search using the following parameters:-

site:yourdomain.com inurl:page-



You will likely find Google has indexed various “/category-name/page-X” URL's for your store and some are in the supplementary index too. This is very bad news for SEO. This causes Google to believe you are intentionally serving identical pages with slightly different page titles - only “Page X” is added to the Title, the rest of the page content does not change.



You need to close this loophole, so the “pages-X” URL's return a 404 not found error. Google will, eventually, clean up the mess left behind and you will soon be back to one single page which you are trying to rank for, the way it should be. Fail to take heed of this warning…and watch your search rankings fall apart.



CS-Cart Support have said this was fixed in “later editions”, the fix has been applied since 3.0.4. If your version is before 3.0.4, your store does require this fix otherwise you have major duplicate content issues.



Open:-

/controllers/customer/categories.php

Find:-


list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page'));


Add the following code below this line:-


if (isset($search['page']) && ($search['page'] > 1) && empty($products)) {
return array(CONTROLLER_STATUS_NO_PAGE);
}




You should only apply the following .htaccess fix after applying the above fix if you have less products in a single category than the number value for “Products per page” in Appearance Settings. If the pagination is required, do NOT apply these htaccess rules.



In the root of your store, open the .htaccess file and add the following rules below the “RewriteBase” line.


RewriteRule ^(.*)/page-2/(.*)$ $1/$2 [R=301,L]
RewriteRule ^(.*)/page-3/(.*)$ $1/$2 [R=301,L]
RewriteRule ^(.*)/page-4/(.*)$ $1/$2 [R=301,L]
RewriteRule ^(.*)/page-5/(.*)$ $1/$2 [R=301,L]
RewriteRule ^(.*)/page-6/(.*)$ $1/$2 [R=301,L]
RewriteRule ^(.*)/page-7/(.*)$ $1/$2 [R=301,L]
RewriteRule ^(.*)/page-8/(.*)$ $1/$2 [R=301,L]
RewriteRule ^(.*)/page-9/(.*)$ $1/$2 [R=301,L]




Duplicate these rules for each “page-X” number you find in the Google search which results in duplicate content. This will ensure the rankings will be passed on to the main category/subcategory page as well as ensuring your customers are not presented with a 404 error.



That's all folks. If you are reading this and your store runs V2-3.0.4, the chances are I have looked at your store and found you have this problem too and should apply this fix ASAP. Any questions, please feel free to ask and I'll do my best to help.

Dear customers, we have fixed this cs-cart seo bug in our latest Canonical url addon. No core file changes. Any existing customers please contact us at [url=“CS-Cart Templates - CS-Cart Skins - CS-Cart Addons - CS-Cart Mods”]http://www.cscartrocks.com/contacts/[/url] for the patch files. Thanks.



Kudos to StellarBytes for raising this bug up. :)

Awesome to hear you have resolved this issue with your addon, I did ask earlier in the week and tried the latest build (which was V1.8 on Monday) on a V2.2.5 store which I have your addon installed on, but I had to revert to the previous fix as above.



How does your fix for the Canonical URL addon work? Does it simply add canonical tags which point to the main category page, or does it eliminate (ie. produce 404 error) for the unnecessary pagination URLs? As not all search engines abide by canonical tags, I think the fix I have applied already is a safer bet - your addon still works wonders for various other issues though and I definitely recommend it.

Interesting. I ran the Google search and a majority of the results were my Manufacturer (Brand) pages with url's such as: www.domain.com/manufacturer.html?page=2



I did see a few categories as you explained above but I would have expected a lot more considering the amount of categories and products I have.

The page URL’s generated by extended product filter types are yet another issue, but I have noted on a 2.2.5 store where the “Brand” filter has been set up to create brand pages, the pagination may show something like “Page 1 of 4”, but if you try to navigate to outside that range, you get a blank page with “There are no products in this section”. Guess that’s slightly better than duplicate product content in some respects, but throughout the course of the site, that’s just a ton of duplicate pages with very little content. I would expect Google would want those to be restricted by robots.txt or to return a 404. Page 5 of 4 should not exist, so should return a 404 error but it doesn’t. Guess I’ll need to look into this too then. Thanks for bringing more enthralling info to light…as if this wasn’t depressing enough as it is! :shock:



With regards to the pages you do have “pages-X” indexed, I even have some where only “pages-2” and “pages-5” appear to be indexed, with no rhyme nor reason as to why “pages-3” isn’t there. Never seem to get above “pages-8” though, which seems strange.



If you Google for “Category Page Title” for the category pages which appear to be duplicates, are you getting one single URL showing up, or are they all over the place?

[quote name='StellarBytes' timestamp='1375962847' post='166485']If you Google for “Category Page Title” for the category pages which appear to be duplicates, are you getting one single URL showing up, or are they all over the place?

[/quote]



I did a specific category search that has 8 pages and they were all in the search.

Well that was easy enough. Add the same code after the same line in:

/controllers/customer/product_features.php

Stellarbytes, you mentioned that there can be a -30 or -40 penalty from Google for this stuff…how do you find out if you are being penalized and by how much?

Combine this issue with the category and products picker issue and bam…your entire store is duplicated multiple times. The only thing CS-Cart have gotten right with this kind of thing is pages. As far as I have found in the code and through search engine results, pages only ever seem to get indexed by the non-seo URL or the SEO-URL, not both.



The store had received a notice in WMT relating to a penalty placed upon it due to duplicate content. I subsequently upgraded to V3, although I had already applied the category/product picker fix on the V2 store which I posted a while back (CS-Cart integrated this fix with V3), the only outstanding issue was the issue in the OP. A few weeks after the V3 upgrade, the notice went away in WMT, the store now ranks well again, as opposed to having a variety of “category-name” and “category-name/page-x” URL's sitting around position 30-50.

I see. I've never had any penalty notices in WMT.

I am failing to see what exactly this does. I had Google fetch one of my specific categories with /page-4 in the link and it fetched it just fine.

[quote name=‘StellarBytes’ timestamp=‘1375958521’ post=‘166474’]

Awesome to hear you have resolved this issue with your addon, I did ask earlier in the week and tried the latest build (which was V1.8 on Monday) on a V2.2.5 store which I have your addon installed on, but I had to revert to the previous fix as above.



How does your fix for the Canonical URL addon work? Does it simply add canonical tags which point to the main category page, or does it eliminate (ie. produce 404 error) for the unnecessary pagination URLs? As not all search engines abide by canonical tags, I think the fix I have applied already is a safer bet - your addon still works wonders for various other issues though and I definitely recommend it.

[/quote]



Thanks for recommending our addon. :)

Our fix is similar as your solution. Non-existent pages should be redirected to 404 page.

The first part of the fix (editing the categories.php controller file) will ensure a 404 Not Found is produced as it should be.



The second part (htaccess) should be used if you have been effected by this failure by design and will 301 redirect back to the category page.

Okay, that was weird. Nothing had changed on 2 of my sites but I finally noticed a change on my 3rd site. The url is now shown as:

http://www.domain.com/cat/sub-cat/#ty;pagination_contents;/cat/sub-cat/page-4/



Now Google does not find the url's with /page-4.



On the 2 stores that nothing had changed, I had to go into Settings->Dynamic HTML and enable AJAX(Javascript)-based pagination.



Edit: Extended product features pages now have this url:

http://www.domain.com/feature_name.html#ty;pagination_contents;/feature_name.html?page=4

A more complex SEO tool to solve this issue. + customizable 404 redirects.

CS-Cart V3

CS-Cart V4

[quote name='ThomH' timestamp='1376976614' post='167077']

A more complex SEO tool to solve this issue. + customizable 404 redirects.

CS-Cart V3

CS-Cart V4

[/quote]

Fail. Fail. Fail. Fail…etc. Think before spamming.

Our Advanced SEO addon also fixed the duplicate content issues and most other SEO issues CS Cart has in one single add-on, easy to maintain and updated.

[quote name=‘StellarBytes’ timestamp=‘1376990161’ post=‘167094’]

Fail. Fail. Fail. Fail…etc. Think before spamming.

[/quote]



Spamming? :confused:

Fail of course on non existent links. :)

Just post real links and check the source code!

[quote name=‘ThomH’ timestamp=‘1377070802’ post=‘167131’]

Spamming? :confused:

Fail of course on non existent links. :)

Just post real links and check the source code!

[/quote]

I’m all for promoting a 3rd party solution if it does indeed provide a fix for a bug, however, your product does not resolve this bug. There is nothing I detest more than someone jumping into a thread without actually reading it, offering a paid solution when the problem isn’t actually resolved by their addon, yet the solution has already posted here for free. See here, thus the “There are no products in this section” message is shown and the page is valid, does not return a 404 error (or at least a 301 redirect) and the canonical tag is incorrect too.



URL:- ```php
http://cscart-addons-3.webgraphiq.com/apparel-en/mens-clothing/page-5/

Canonical Tag:-<br />
```php
<br />
<link rel="canonical" href="http://cscart-addons-3.webgraphiq.com/apparel-en/mens-clothing/page-5/" /><br />