Skip to content

osCommerce and duplicate content

If you’ve got an osCommerce store set up you are probably fighting a duplicate content problem with the search engines. The problem is that OSC has an almost limitless number of ways to view any one particular product page – 1 for each category that the product is in plus one without any category information. The cPath variable in the query string is the culprint.

Here’s how I got around it and my search engine traffic, as small as it is, has been growing.

I wanted the product_info.php file without any cPath variable to show up as the default. It’s what shown in my Sitemap so that’s what Google is looking for anyway. Plus the no category version is what is shown for the recent additions and a few other pages that escape me right now.

What I did is edit the header_tags.php file from the aptly named Header Tags Generator 2.0 by At the bottom of the file, just above “echo ‘‘;” you’re going to add this code.

if ($_SERVER['PHP_SELF']=='/product_info.php' && $_GET['cPath']!=''))
echo '<meta content="noindex,follow" name="robots" />'."\n";

This will add a robots meta tag telling the robot to follow any links, but not to index this page.

Published inProgramming

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *