Main page URL fix in osCommerce

Many web sites suffer from their main (home) page has low page ranks in search engines, even though other pages are ranked well. The main reason for this is that there exist multiple links to different URLs of the main page of such web site from other web sites and from internal pages of the web site itself.

Page rank then splits between those multiple URLs, and none of them usually gets high rankings. When if there was only one URL to the main page of the web site – it would have had higher page ranks in the search engines.

This problem often appears in osCommerce online stores, when the main page can be referred in multiple different ways. For example, the main page can be referred as http://www.mystore.com and as http://mystore.com and as
http://www.mystore.com/index.php Effectively the page rank that could have
been given to the main page of such osCommerce online store is split between the three URLs, as search engines consider those three URLs to be different. More than that, a duplicate content issue may appear as well since all three different URLs would be pointing to one and the same page with one and the same content.

To avoid such issues in osCommerce the following fixes can be implemented:

  • first lets solve the http://mystore.com and http://www.mystore.com issue by
    adding the following redirect command into .htaccess file, which is located in the
    root folder of the osCommerce web site:

RewriteCond %{HTTP_HOST} ^mystore\.com$ [NC]
RewriteRule ^(.*)$ http://www.mystore.com/$1 [R=301,L]

  • secondly, in the /includes/configure.php file make sure the web site URLs are
    properly specified. Like, for example:

define(’HTTP_SERVER’, ‘http://www.mystore.com’);
define(’HTTPS_SERVER’, ‘https://www.mystore.com’);

  • finally, get rid of the http://www.mystore.com/index.php links and change
    those to http://www.mystore.com/ by modifying the .htaccess file again:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.mystore.com/ [R=301,L]

These fixes above assume osCommerce is running in the root folder of the web site.

Leave a Reply