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

OK, I've been wondering, but now I just need to know:

 

1) Are there any servers anywhere that naturally go to default instead of index?

 

2) Is there somewhere in the world where the zip code goes before the state?

 

3) Is there somewhere in the world where they call the second line of the address the suburb?

 

4) Is the default store text hardcoded instead of in the admin just to make sure everyone has to hack at least once?

 

5) On the actual subject of this thread, is the horse dead or should we keep beating it?

 

P.S. - Not complaining, just wondering. I picked up PHP by working with osCommerce and learned it and like it well enough that I have converted my other web sites to use PHP. Require/include is way better than the HTML cut and paste method for keeping web sites maintainable.

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

  • Replies 65
  • Created
  • Last Reply
OK, I've been wondering, but now I just need to know:

 

1) Are there any servers anywhere that naturally go to default instead of index?

 

2) Is there somewhere in the world where the zip code goes before the state?

 

3) Is there somewhere in the world where they call the second line of the address the suburb?

 

4) Is the default store text hardcoded instead of in the admin just to make sure everyone has to hack at least once?

 

5) On the actual subject of this thread, is the horse dead or should we keep beating it?

 

P.S. - Not complaining, just wondering. I picked up PHP by working with osCommerce and learned it and like it well enough that I have converted my other web sites to use PHP. Require/include is way better than the HTML cut and paste method for keeping web sites maintainable.

 

1 Yes ... they have been properly configured for this. Depends on the hosting site.

 

2 no clue

 

3 Europe ... most of the osCommerce Team is from Europe ... :D

 

4 All the text is in language files. Some where ... some how ... someone has to decide what it should read.

 

5 I like to keep beating it ... 8)

 

Latest Google email ... "Join the forums for help"

Link to comment
Share on other sites

That's what i was tring to say burt :lol:

 

Yeah I know, but it looked like you got ignored... ;)

 

Sounds like Xamu will stick to his guns about requiring default.php into index.php anyway - but it's a bad move.

 

BTW, all of the servers that I admin all have default.php as a directory index - most "Hosts" wouldn't have a clue how to change it.

Link to comment
Share on other sites

I think orchard's post was tongue in cheek... :wink:

 

p.s. I don't think the second line of an address is called "Suburb" in Europe - I've never seen it anywhere before anyway! If anything, i thought it was an Americanism. Guess it's a mystery then :?

Link to comment
Share on other sites

p.s. I don't think the second line of an address is called "Suburb" in Europe - I've never seen it anywhere before anyway! If anything, i thought it was an Americanism. Guess it's a mystery then :?

 

I always figured that was a European thing. It sure isn't from here ... we call it something silly like Address 2 ... :D

Link to comment
Share on other sites

BTW, all of the servers that I admin all have default.php as a directory index - most "Hosts" wouldn't have a clue how to change it.
Must be an English or European thing. I have several domains and have gone through several hosting companies recently and none of them naturally handled default.php as the index file.

 

The problem with editing the files to use index.php instead of default.php (besides beginners not knowing how) is that once your store is up and running, people put it in their favorites so you need to keep default.php working for them.

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

BTW, all of the servers that I admin all have default.php as a directory index - most "Hosts" wouldn't have a clue how to change it.
Must be an English or European thing. I have several domains and have gone through several hosting companies recently and none of them naturally handled default.php as the index file.
:D :lol: All the hosting companies you've used need a boot up the backside then. It is literally 30 seconds work to change it to accept default.php...

 

Well, thats not strictly true. The person who went in from their faves would just error out to 404.

 

You do have a 404 page right ? ;) :)

 

You could even make your 404 be default.php?action=404

 

And then pick up the $action, and give a nice error message...

 

Easy.

Link to comment
Share on other sites

Sounds like Xamu will stick to his guns about requiring default.php into index.php anyway - but it's a bad move.
Only until I hear a convincing argument. :lol:

 

So far I haven't been convinced. The alternatives that have been offered are all more work and/or require specific knowledge of osC conventions.

 

But I'm not unconvinceable. :wink:

Link to comment
Share on other sites

Yes, I have a 404 page. It removes the .html from the end of requested document and tries it again with .php on the end, because I recently reorganized my web site using PHP.

 

I think we better bring in a new horse before PETA gets after us.:)

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

I am a little confused about trying to determine who has the 'better' method here. I tried the short index.php script seeking a default.php file, but it didn't work for me.

And of course I don't want to have any problems with search engines...

My files have a couple root files before getting to the catalog:

http://ezhandsfree/ecommerce/catalog

 

So, I tried this code in index.php:

<?php

require('ecommerce/catalog/default.php');

?>

 

And got this error code:

Warning: main(includes/application_top.php) [function.main]: failed to create stream: No such file or directory in /home/ezhandsf/wwwroot/ezhandsfree.com/ecommerce/catalog/default.php on line 13

 

Fatal error: main() [function.main]: Failed opening required 'includes/application_top.php' (include_path='') in /home/ezhandsf/wwwroot/ezhandsfree.com/ecommerce/catalog/default.php on line 13

 

Suggestions?

:? Jenn

Link to comment
Share on other sites

I think to have an index.php file that includes default.php and have it work they have to be in the same directory. One solution would be to move your store to the root directory, but then you would have to edit the configure.php files appropriately.

 

I just looked a http://www.php.net and there is a change directory function so this might work:

<?php 

chdir('ecommerce/catalog');

require('default.php'); 

?>

I haven't tried it, but it's worth a try. :)

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

So, I tried this code in index.php:

<?php  

require('ecommerce/catalog/default.php');  

?>

You did it wrong. Leave out the ecommerce/catalog/ part

 

It's just

<?php

require('default.php');

?>

 

And it should be in the catalog directory. You were making it look for ecommerce/catalog/ecommerce/catalog/default.php if the index.php file was in ecommerce/catalog/

 

Of course, ecommerce/catalog/ecommerce/catalog/default.php doesn't exist.

Link to comment
Share on other sites

Xamu,

I think the problem is that she wants http://ezhandsfree to go to the store who's default page is at http://ezhandsfree/ecommerce/catalog/default.php. By requiring default.php from the root directory, it is trying to find /includes/application_top.php when it should be looking for /ecommerce/catalog/includes/application_top.php. I just tried the chdir method and it works with this code.

<?php

chdir('catalog');

include 'default.php';

?>

You can try it at http://www.arbucklechurch.org/test.php. I didn't name it index.php because I didn't want to block access to our main web site.

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

and/or require specific knowledge of osC conventions.
Is that not the point of using Oscommerce ? To find out how it works and then make it fit your needs ?

 

For anyone trying the "require" method, it's flawed and pointless.

 

All you need to do is one of these:

 

1) Get your host to add default.php into the DirectoryIndex of httpd.conf (this is about 30 seconds work for the host)

 

OR

 

2) Go the .htaccess route:

 

DirectoryIndex default.php

 

Place your .htaccess into the r00t of your website. This may or may not work depending on how your host has his httpd.conf set.

 

OR

 

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');

 

DONE! Each of these methods will take less than 2 minutes.

Link to comment
Share on other sites

I have always thought that the 3rd way Gary has mentioned was the best, and it has never failed me.

 

It literally does take about 2 mins MAX.

And no problems with search engines too.

 

CC.

Link to comment
Share on other sites

For anyone trying the "require" method, it's flawed and pointless.
How? Not that I don't believe you or that I'm doubting your judgement, but I am new at this and would like to learn and to know what's wrong with it.

 

Also, if you are in nrapt's situation where your store is installed and working, but now you wish it was in a different directory, is there a simple solution? Simpler than the chdir & require method?

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

For anyone trying the "require" method, it's flawed and pointless.
How? Not that I don't believe you or that I'm doubting your judgement, but I am new at this and would like to learn and to know what's wrong with it.
Look at nrapts post for more details. You can't require from a directory outside of the directory you are in without causing issues with Oscommerce.

 

Also, if you are in nrapt's situation where your store is installed and working, but now you wish it was in a different directory, is there a simple solution?  Simpler than the chdir & require method?

 

Yeah, SSH in, mv the contents of catalog and then reconfigure confiure.php. Or just FTP in, download. Move to r00t, upload. Change configure.php. Bit of a pain if you are on 56k, but doable.

 

Or get your host to set the DocumentRoot to the directory you are installed to. They most likely wouldn't do it, but it's perfectly possible.

Link to comment
Share on other sites

Look at nrapts post for more details.  You can't require from a directory outside of the directory you are in without causing issues with Oscommerce.
That's why you need to call chdir before doing the include or require. It worked for me.

I think the .htaccess method and putting things in the right directory may be more technically correct, but there are several issues with it for people, like:

1) You need shell access to do mv and you need to know at least one Unix command. I actually have shell access and know some Unix commands, but that's not really the point here.

2) .htaccess doesn't show up in WS_FTP, to get it I had to use the command prompt FTP.

3) Most of the files on my server are owned by me, but the images for the products are owned by "nobody", so I can't delete them using FTP.

 

If there is something really wrong with the chdir & include method, I would like to know. I have a feeling that it's more a personal preference issue like whether you should name a multiple word variable my_variable or myVariable.

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

Just for the record if anyone else has the same struggle...

I had to create index.php file (in root file) with this code:

<?php

chdir('ecommerce/catalog');

require('default.php');

?>

...and it worked!!!

Thank you everyone for your contributions!

Link to comment
Share on other sites

In reading back over newest posts, I am seeing a reference to the require method as "flawed." It is working on the site in the sense that when you type in the URL, it pulls up the catalog properly. But do the CHDIR and REQUIRE actions create problems with search engines?

Link to comment
Share on other sites

The CHDIR and REQUIRE are done on the server so the search engine or customer's browser is unaware. The only problem I could see with the search engine is that you now have two identical or extremely similar URLs, one at http://ezhandsfree/ecommerce/catalog/default.php and one at http://ezhandsfree/index.php. I don't know if search engines object to duplicate URLs.

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

  • 2 weeks later...

As Burt stated twice on this topic

 

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');

 

DONE! Each of these methods will take less than 2 minutes.

 

Burts solution is so easy

I just want to know if this is 100% ok to do, it's easy to do, I am only concerned if I add any contributions in the future if they reference default.php, if not I will change to index.php because my ISP does not want to add default.php.

And what about the database, it wont affect this either.

 

regards tim

Link to comment
Share on other sites

Another concert would be whether search engines have already indexed default.php or customers have already made it one of their favorites/bookmarks.

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

Archived

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

×
×
  • Create New...