Latest News: (loading..)

Archived

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

Xamu

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

66 posts in this topic

because your host doesn't recognize default.php as the page to automatically load then you can write a little wrapper script that should solve the problem:

 

Call this index.php

<?php

require('default.php');

?>

That should fix the problem.

 

Frankly, I don't know why it's not called index.php instead of default.php in the first place but whatever.

Share this post


Link to post
Share on other sites

That will upset the Search Engines ... :shock:

 

Better to use a .htaccess file or edit the existing one to include:

DiRectoryindex index.shtml index.html index.htm index.php default.php /missing.html

AddHandler server-parsed .shtml

AddHandler server-parsed .html

AddHandler server-parsed .htm

 

Note: This goes in the root and create a missing.html in the root as that is referenced too.

Share this post


Link to post
Share on other sites

Yeah, I suppose you're right. I know my host doesn't autoload default.php for some reason. I didn't think people were even using default.??? anymore. I thought it was deprecated by now.

Share this post


Link to post
Share on other sites

I am not sure.

 

But the .htaccess keeps the Search Engines happy ... :D

Share this post


Link to post
Share on other sites
That will upset the Search Engines ... :shock:
You know, I bought your answer without thinking about it. Why would it upset the search engines? It's not a redirect. It's just a way to get the page loaded without an error. There are hundreds of includes or requires in the code already. As far as the search engine is concerned, there is just a page that has stuff.

Share this post


Link to post
Share on other sites

You can speak to Robert on this one ... the search engines know that nothing is on the index.php page so they toss you.

 

He was saying yesterday he got shut out for that one ... might try to find that thread.

 

I am not a search engine so I cannot explain it very well ... but it is similar to a redirect page more or less.

Share this post


Link to post
Share on other sites
I think Robert's post was about a redirect (see http://forums.oscommerce.com/viewtopic.php?t=32695).  I use an index.php that includes default.php and when I view source on either index.php or default.php they are exactly the same so I don't know how the search engine would know anything that it could get upset about.
Of course it's the same. The idea is that http://www.domain.com/catalog should load default.php but on some hosts it doesn't. So creating an index.php file that jams the contents of default.php inside of it means that http://www.domain.com/catalog does display the page correctly. For all those links that point at http://www.domain.com/catalog/default.php then it doesn't do anything to add more pages to a search engine.

 

I can see no reason at all that this isn't a MUCH easier alternative to .htaccess. Not that your solution isn't fine. Just more work.

Share this post


Link to post
Share on other sites

I may have to break down and contact Google at some point on some of these issues.

 

I would think if the Search Engines dumped him for this, that they have not changed their testing methods. But it never hurts to double check.

Share this post


Link to post
Share on other sites
The best way is to change the name of the default.php to index.php and goto inc/application_top.php and change from default.php to index.php, then in your language files change the default.php files to index.php also.

 

Redirection will kill your site with about just every search engine.

 

Robert L.

Well, I have to disagree with Robert on his first point; the best way is not to have two copies of a file and make dozens and dozens of changes, renaming as you go. That would probably break hundreds of Mods.

 

I agree with him on the latter point. My method just fixes the problem without redirects and without massive changes. It eliminates the need for a .htaccess file (which some hosts don't allow mere customers to create) and is easy enough for anyone to do.

 

Hot dog! I found a way to be useful in my own small way. :D

Share this post


Link to post
Share on other sites

The first point is the original file is technically two files ...

 

/catalog/default.php

/catalog/languages/english/default.php (plus other languages if used)

 

To rename to index.php you have to rename both files and change the one define from default.php to index.php

 

Not much choice around that or any other file you want to use with a language setting match ... :D

Share this post


Link to post
Share on other sites
Hot dog!  I found a way to be useful in my own small way. :D

 

Any new idea is always helpful and useful, silly!

 

Someone will always be benefitted from and that is the beauty of sharing new ideas ...

 

I hope I did not make you feel that your idea was not helpful. That was not my intent.

 

I just suggest on this particular issue to be cautious and perhaps take the time to contact support on a few search engine sites to see what they have to say about the possible solutions to be sure you don't end up on the bad list ...

Share this post


Link to post
Share on other sites

I think that Xamu's idea which I also use is OK because it is not a redirect. A redirect is done by the client's browser reading the first page and realizing that it needs to read the page it is being redirected to. The PHP require or include is a copy made on the fly on the web server and the client is unaware of any difference from a normal page.

Share this post


Link to post
Share on other sites
The first point is the original file is technically two files ...

 

/catalog/default.php

/catalog/languages/english/default.php (plus other languages if used)

 

To rename to index.php you have to rename both files and change the one define from default.php to index.php

 

Not much choice around that or any other file you want to use with a language setting match ... :D

I don't think that's entirely true. .../languages/english does not appear to be a servable folder. I suspect that the default.php file may be an include file for some other page?

 

Since the beauty of php includes and requires is that the page is dynamic and created by the server on demand then the browser (or spider) thinks that everything is hunky-dory when it goes to /catalog or /catalog/default.php. Of course there should NOT be an index.html, index.htm or index.shtml since they would probably not interpret php code inside and would require a redirect.

 

And while I know that *I* have no weight to throw here it would be my recommendation that future versions change the filename from default.php to index.php. That would eliminate the need for this patch.

Share this post


Link to post
Share on other sites

Now I'm a bit confused after reading this thread, but what is the verdict here? Luckily, I host my own server so I can just add default.php to httpd.conf in apache. But, I honestly don't see how having an index.php that 'require's default.php could possibly affect a spider? A meta or javascript redirect, which are client-side redirects, I could definitely see causing major problems.

 

But by doing things in PHP on a server-side basis, when a spider, or anything else on the web, tries to access index.php, since all the php processing happens before Apache even starts serving the page, I really don't see how any client could possibly see that index.php is any different. Or am I missing the point completely?

 

I dont mean to sound like a pain or anything, I'm just trying to understand the arguement against doing that? Was someone really reprimanded by google for doing a PHP require thing like this? Or was it some other form of redirecting?

Share this post


Link to post
Share on other sites

I emailed Google on this. Have to see if they give me an answer. So far, just the standard "We got your email"

Share this post


Link to post
Share on other sites
Now I'm a bit confused after reading this thread, but what is the verdict here? Luckily, I host my own server so I can just add default.php to httpd.conf in apache. But, I honestly don't see how having an index.php that 'require's default.php could possibly affect a spider? A meta or javascript redirect, which are client-side redirects, I could definitely see causing major problems.
Neither do I. Especially when no requests are likely to be made to catalog/index.php. catalog/ certainly. catalog/default.php probably (from something in the osC code).
But by doing things in PHP on a server-side basis, when a spider, or anything else on the web, tries to access index.php, since all the php processing happens before Apache even starts serving the page, I really don't see how any client could possibly see that index.php is any different. Or am I missing the point completely?
No, I don't think so. To any browser, index.php is identical to default.php. But again, there's probably never going to be a request to serve catalog/index.php (unless you write a link to that specific address - and why would you?). What we're trying to accomplish (and succeeding) is serving http://www.domain.com/catalog (excluding the default.php part). And while that may cause the search engine to record both /catalog and /catalog/default.php in its database it doesn't matter because if the host worked properly and served /catalog as the main page there would still be some script that links to /catalog/default.php - so it would be in the search engine database twice regardless.
I dont mean to sound like a pain or anything, I'm just trying to understand the arguement against doing that? Was someone really reprimanded by google for doing a PHP require thing like this? Or was it some other form of redirecting?
I don't mean to sound like one either :shock: but I think that there was a misunderstanding about what someone else said about search engines. If you had an index.html, index.htm or index.shtml then you would have to do a redirect which would maybe give a search engine heartburn. This doesn't do that. The search engine gets the right page at the (correct) address it went to and so it's happy. But I'm happy to let Linda get the scoop from Google which I think will prove me right. (Statistically speaking, it was bound to happen at some point. :lol: )

Share this post


Link to post
Share on other sites

Hello all - my first post, so here goes...

 

I am pretty sure that you will not get the boot from Google for using the require() method suggested by Xamu as hundreds of php pages use this and are listed in serch engines fine because, as has been mentioned, the pages are parsed before being delivered to the spider.

 

The only problem I can see is the duplication problem i.e. index.php and default.php will have identical content which Google tends to frown upon.

 

The best method is to rename default.php to index.php IMHO - takes all of two mins to make the necessary changes.

Share this post


Link to post
Share on other sites
The best way is to change the name of the default.php to index.php and goto inc/application_top.php and change from default.php to index.php, then in your language files change the default.php files to index.php also.

 

Redirection will kill your site with about just every search engine.

 

Robert L.

Well, I have to disagree with Robert on his first point; the best way is not to have two copies of a file and make dozens and dozens of changes, renaming as you go. That would probably break hundreds of Mods.
Well, I should open my mouth more often. My toes like the breeze. :oops:

 

It appears that in the core osC code, nothing links to default.php. So changing it to index.php would work just fine.

 

Having said that, I don't know if there are any Mods which link specifically to default.php so if there are then renaming it could cause a problem. But I stand behind my assertion that the require method I posted above should cause no ill effects in either case. Until, of course, I'm proven wrong at which point I'll slink into the shadows and act all humble. :wink:

Share this post


Link to post
Share on other sites
It appears that in the core osC code, nothing links to default.php.
I was thinking that too and was going to suggest that Google would never find the duplicated default.php because nothing is linked to it, but it looks like "Catalog" in the bread crumb trail is linked to default.php.

Share this post


Link to post
Share on other sites
I was thinking that too and was going to suggest that Google would never find the duplicated default.php because nothing is linked to it, but it looks like "Catalog" in the bread crumb trail is linked to default.php.

Exactly why you should use the re-name or .htaccess method.

 

The require method will just ensure a page is brought up when you type in the address to your catalog without specifying a file. Clicking any links will then take you to default.php.

 

Catalog in the breadcrumb trail is linked to whatever you have defined FILENAME_DEFAULT to be in application_top.php. No links in the core code (or in any contributions come to that) should be hardcoded to point to default.php :shock:

Share this post


Link to post
Share on other sites
I was thinking that too and was going to suggest that Google would never find the duplicated default.php because nothing is linked to it, but it looks like "Catalog" in the bread crumb trail is linked to default.php.

Exactly why you should use the re-name or .htaccess method.

But it's not duplicated. It's the same file. Renaming it would require more work (as you stated above). Same for the .htaccess method. Part of the problem is that some folks can't create an .htaccess file. Probably more don't know how. This is a simple cure instead of a complicated one. :D

 

The require method will just ensure a page is brought up when you type in the address to your catalog without specifying a file. Clicking any links will then take you to default.php.
Right. It doesn't matter what other links point at. This just gives you a nice, clean, short address for you to have for your store. One that works for those people whose hosts don't automatically serve default.php.

Share this post


Link to post
Share on other sites
<snip loads of stuff>

 

What are you talking about ?

 

application_top.php:

 

change define('FILENAME_DEFAULT', 'default.php'); TO define('FILENAME_DEFAULT', 'index.php');

 

Rename the following file:

default.php TO index.php

/includes/languages/<language>/default.php TO /includes/languages/<language>/index.php

 

 

 

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

Share this post


Link to post
Share on other sites
But it's not duplicated. It's the same file.

 

In the eyes of a search engine, index.php and default.php are two different files with exactly the same content.

 

Agree with you that it is a quick and simple fix though :D

Share this post


Link to post
Share on other sites