Community Add-Ons

Maintainers: FixItPete
Add file to this package
Top » Other

Root install /index.php fix
for osCommerce Online Merchant v2.2

If you have a store that is installed in the root directory (you DO NOT have a /catalog dir -- you go directly to www.domain.com and your store is right there) this contribution may be for you.

What it does:

When you are on a page your site, to search engines especially, would show as www.domain.com AND www.domain.com/index.php we all know that you don't need the index.php one and you do not want to show two links with the same content to the search engines...

So. here is what I did.

First in:

index.php

Change:

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

To:

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT_HOME);

Then, in: includes/filenames.php find:

define('FILENAME_DEFAULT', 'index.php');

And change it to:

// Start index.php fix.
// define('FILENAME_DEFAULT', 'index.php');
define('FILENAME_DEFAULT', '');
define('FILENAME_DEFAULT_HOME', 'index.php');
// End of index.php fix.

Now all the links in header and footer, etc. that use to say www.domain.com/index.php will only say www.domain.com.

There are A LOT of other fixes for this on osCommerce forums and they either involved changing a bunch of files and other ways that I couldn't get to work (I'm sure they must work, but I couldn't get them to work (along with a few other people).

I have tested this as much as I could -- if you can make it better, please do so!

Pete

Legend:  Download   Report

Expand All / Collapse All

Little Fix fozzo 17 Feb 2009  

---------------------Fozzo's Fix------------------

Since file header_tags.php generate an error of function all you folks have to do is open that file that is place in catalog/includes/
open it and

Line 31

FIND:

case (strstr($_SERVER['PHP_SELF'],FILENAME_DEFAULT) or strstr($PHP_SELF,FILENAME_DEFAULT)):
$pageTags_query = tep_db_query("select * from " . TABLE_HEADERTAGS . " where page_name like '" . FILENAME_DEFAULT . "' and language_id = '" . (int)$languages_id . "'");
$pageTags = tep_db_fetch_array($pageTags_query);

REPLACE WITH:

//Index Fix
case (strstr($_SERVER['PHP_SELF'],FILENAME_DEFAULT_HOME) or strstr($PHP_SELF,FILENAME_DEFAULT_HOME)):
$pageTags_query = tep_db_query("select * from " . TABLE_HEADERTAGS . " where page_name like '" . FILENAME_DEFAULT_HOME . "' and language_id = '" . (int)$languages_id . "'");
$pageTags = tep_db_fetch_array($pageTags_query);
//Index Fix

That's it, thanks to original creator, all credits go to him!

--------------------Fozzo's Fix-------------------

Root install /index.php fix FixItPete 25 Jan 2007