Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

oscsis in URL causing duplicate content issues. Adding canonical links to index, advanced_search_results, etc ?


Recommended Posts

My SEMRush SEO report tells me that some of my pages may be crawled as duplicates on account of the oscsid being present in the URL. This could cause Google to penalize my site for duplicate content. I run 2.3.4 BS Gold and use the SEO URL feature.

The duplicates are for URLs like:

https://www.domain.com/conditions.php
https://www.domain.com/conditions.php?osCsid=3vpp1e4aaj4rgt5cdhjd44pik1

https://www.domain.com/contact_us.php
https://www.domain.com/contact_us.php?osCsid=st5hl2sjcd01ih3n3sc1qn0831

https://www.domain.com/impala-red-pr-2194.html
https://www.domain.com/impala-red-pr-2194.html?osCsid=st5hl2sjcd01ih3n3sc1qn0841
(Notice this one is the product review page for a specific product, the product_info page correctly adds a canonical link)

etc

So far the pages that cause problems are:
index.php
conditions.php
contact_us.php
advanced_search_results.php
privacy.php
products_new.php
returns.php
shipping.php
and the product review page for a specific product

On the Google Search Console page, where you get to specify how the google bot uses parameters of your URLs, they say that I should NOT use their tool if my site has less than 1000 pages. It does not.
Another potential solution would be to add canonical links to those key pages. Canonical links are already being added to the category and product pages via the header tag module, but not pages like advanced_search_results.php or index.php or conditions.php etc.

Is there a better solution than adding canonical links? Can I somehow prevent the oscsid from being used in the URL?

How can I add canonical links to these pages, correctly? I don't want to break any of the proper indexing of my site. I looked at the ht_canonical function and it's pretty simple:

if (basename($PHP_SELF) == FILENAME_PRODUCT_INFO) {
        $oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$HTTP_GET_VARS['products_id'], 'NONSSL', false) . '" />' . "\n", $this->group);
      } elseif (basename($PHP_SELF) == FILENAME_DEFAULT) {
        if (isset($cPath) && tep_not_null($cPath)) {
          $oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath, 'NONSSL', false) . '" />' . "\n", $this->group);
        } elseif (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
          $oscTemplate->addBlock('<link rel="canonical" href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . (int)$HTTP_GET_VARS['manufacturers_id'], 'NONSSL', false) . '" />' . "\n", $this->group);
        }
      }

I could add an elseif for each of the static pages like conditions.php, contact_us.php, privacy.php, products_new.php, returns.php and shipping.php. But what about advanced_search_results.php, the product reviews page, and index.php? Those are bit more complicated because I would have to rebuild the proper canonical link (beyond my weak php kunfu).

Has anyone had the same problem? Best solution? little help?

Cheers!

Link to comment
Share on other sites

I found a potential solution on Stack Overflow that suggested that simply setting configuration>sessions>Force Cookie Use to True might prevent the oscsid from being used in the URL. I turned that on, let's see what it does.

Link to comment
Share on other sites

Set 'Prevent Spider Sessions' to true

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Also, you don't want advanced_search_result indexed - put it in your robots.txt

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...