Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

If you get a directory listing instead of your main page...


Guest

Recommended Posts

I think the chdir php code has some other potential uses like whenconverting a live site of one type to oscommerce. It world be nice to have all the OSC stuff in a "store" directory.

 

I hope we get an answer from google on this...

Link to comment
Share on other sites

  • Replies 65
  • Created
  • Last Reply

I have been following this thread with interest, and i thought i would share my thoughts and practices with you all.

 

Basically i think that the 3 solutions mentioned all work well but in there own right.

 

The htaccess method works fine, if you have access to the file, and also if the catalog part of your site is in the root directory.

 

The 'os way' as gary put it also works very well is just as quick as any of the other ways mentioned. The only problem i find with this is that if you have your store in the root/catalog/ folder then when someone types in www.mydomain.com it does not goto the required folder. especially if you want root/catalog/default.php as your main page.

 

The first way mentioned and that has been discussed a lot is the includes way. This method is not flawed, but it is not ideal. As already pointed out it causes 2 pages that are similar if not identical. This is a problem with the search engines, but not a major one. I have various sites with similar pages and google PR of 6 at one time now its 5.

 

However the top two ways are fine, if you have your catalog in the root/catalog directory and you want root/catalog/default.php to be your main homepage when someone types in www.yourdomain.com I have done the following.

 

In root/index.php i added the following code (already mentioned in this thread)

<?php

chdir('catalog');

require('default.php');

?>

 

Then in catalog/includes/languages/english.php i found the following two lines

define('HEADER_TITLE_TOP', 'Top');

define('HEADER_TITLE_CATALOG', 'catalog');

 

and changed them to this

define('HEADER_TITLE_TOP', 'Home');

define('HEADER_TITLE_CATALOG', '');

 

Basically all this has done has removed the link to default.php from the breadcrumb so when the search engines are looking around the site they cant find it, thus they dont spider two identical pages.

 

There is one drawback with this method and that is that a lot of "continue" buttons point back to default.php if anyone can tell me how to make

define('FILENAME_DEFAULT
point to the root/index.php instead off root/catalog/default.php that would have this little problem licked :)
Link to comment
Share on other sites

I think you can get what you want by commenting out

  $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

in includes/application_top.php, but I haven't tried it.

In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Link to comment
Share on other sites

This still doesn't answer the question why does OSC use default.php at all for the catalog and not index.php - after all it used for admin??

Link to comment
Share on other sites

I would guess that there is some historical reason, like osCommerce was first developed on an existing web site that already had an index.html so they had to choose a different name during development and it never got changed back. I think the admin section is relatively new and normally in a subdirectory so it could use index.php.

In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Link to comment
Share on other sites

That doesn't make much sense. You wouldn't want an index page and a default page fighting for which is loaded.

Link to comment
Share on other sites

I've never used a server that loaded default instead of index without being told to, so it doesn't seem like it would be much of a fight. However my information is from an unscientific survey of about 10 hosting companies, maybe there are some that prefer default to index.

In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Link to comment
Share on other sites

The theory is that either should load. But one would never have both in the same folder. Default is no longer the default. Once upon a time when Tandys roamed the earth, maybe. :lol:

Link to comment
Share on other sites

I have done this - Gary's way:

 

3) Do it the Oscommerce way:

 

- FTP into your webspace, rename default.php to index.php

- also rename includes/languages/<language>/default.php to includes/languages/<language>/index.php

- Open includes application_top.php and change define(FILENAME_DEFAULT, 'default.php');

TO

define(FILENAME_DEFAULT, 'index.php');

 

but just wanted to doublecheck something.

 

1. Does this mean that I can delete the default.php files (the root one and the languages one)?

 

2. Does this mean that any mod etc that tells me to do something in default.php I now do in index.php?

 

Sorry, these are pretty dumb questions but I just don't want to get caught out. :)

 

 

Oh, and I wanted to point out that in newer snapshots this define is in includes/filenames.php

- Open includes application_top.php and change define(FILENAME_DEFAULT, 'default.php');

TO

define(FILENAME_DEFAULT, 'index.php');

 

Jen

I haven't lost my mind - I have it backed up on disk somewhere.

Link to comment
Share on other sites

Jen:

1. Yes

2. Yes (unless the contributor has not used Osc naming system)

 

Hosting stuff:

It's a 30 second change for the host to have default.php available to customers!

~ SSH in

~ pico the httpd.conf file

~ Edit the DirectoryIndex bit to add default.php (or anything else!)

~ Save the httpd.conf file

~ apachectl stop, apachectl start

 

hth

Link to comment
Share on other sites

The theory is that either should load.  But one would never have both in the same folder.  Default is no longer the default.  Once upon a time when Tandys roamed the earth, maybe.  :lol:

 

The reality is that you can have as many as you like in the same folder. Depending upon what is in the httpd.conf, will depend upon which index is loaded.

 

In effect, the machine will look for the first index page in the list, eg:

 

index.html index.htm index.shtml index.php default.html default.php

 

And so on. The folder can have all of these without problems. But if you wanted Oscommerce to work, you would only be able to have a default.php file in your webspace as the start page. *Unless*, the httpd.conf looked like:

 

default.php index.html index.htm index.shtml index.php default.html

 

As the box would then look for default.php first (and dispplay it) if it exists.

 

hth

Link to comment
Share on other sites

If you have never had a problem with default.php (ie. it was serving it all up correctly) then is there any reason to make these changes? People were talking about a possible issue with Search Engines seeing duplicate pages (default and index).

 

Jen

I haven't lost my mind - I have it backed up on disk somewhere.

Link to comment
Share on other sites

2 minutes work maximum, for even the greenest person.  This does not create any extra work at all, all references in the code to default.php are now index.php as the code looks like this (for example):

 

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce') . '</a>'; ?>

 

Took me 30 secs and I'm pretty green ;)

Link to comment
Share on other sites

2 minutes work maximum, for even the greenest person.  This does not create any extra work at all, all references in the code to default.php are now index.php as the code looks like this (for example):

 

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce') . '</a>'; ?>

 

Took me 30 secs and I'm pretty green ;)

 

That means you had a whole 90 seconds to spend doing something more interesting :D Ra!

Link to comment
Share on other sites

As with all software fixes, it's quick and easy IF you know where to do it. If Windows came with things that only worked right after a one line tweak to the registry, it would be an easy fix, but unacceptable. (Yes, I know Windows isn't free, osCommerce is, etc.)

 

I think osCommerce needs to focus less on developers and more on users (shop owners). Developers know what they are doing and should be able to tweak things to their liking. The default setup should be good for the users without tweaking.

In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Link to comment
Share on other sites

  • 4 weeks later...

I was reading everyone's post in this discussion topic...it was very helpful. Thanks for all the constructive comments.

 

This was the last thing I had to do. I changed the default.php into index.php as per advice. And it works very well.

 

Unfortunately I noticed afterwards that the site had already been indexed by Google. So now I am asking my hosting company to add the default.php to the httpd.conf.

 

I was wondering and this might be a little off topic...but I use a javascript dhtml menu (Coolmenu 4) as my main form of navigation. This is for the: Home button, About us button, All Products, Contact, Shopping cart, and Checkout. It's really very easy for the customer to navigate.

 

My worry now is: Does the search engine spider this type of a menu? I mean is it able to read and follow the links from the dhtml menu?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...