Page 1 of 1

recursive tree problem with php vs html

Posted: Wed Jun 25, 2003 4:24 pm
by jennifer
Greetings!

I've got the latest apache (1.3.27.0-1) and php4 (4.2.3-14)
packages, and I've noticed a very strange thing. If I create a file
in the root of the web server (/var/www) named 'foo.php' that looks
like this:

<?php echo "<HTML><HEAD></HEAD><BODY>BODY</BODY></HTML>\n" ?>

when I go to http://webserver/foo.php, I get a page that looks
appropriate. I also get this page when I go to:

http://webserver/foo/anything/I/type/here/is/ok

One other piece of data. If I create an empty file named 'foo.html'
in the same directory, I start getting the appropriate 404 errors
when I go to /foo/ locations.

Eh? The problem is that this sort of thing appears to be happening
when crawlers (and my htdig) hit my site. The result is a recursive
tree that goes on forever.

:?: What's up with this? Any thoughts on how to fix it?

Thanks!

Posted: Thu Jun 26, 2003 9:53 am
by daven
The trailing slash problem is an Apache thing. ie--typing http://www.site.com/mydir/subdir looks for the file "subdir" in the "mydir" directory, rather than the file "index.html" in the "subdir" directory. To make Apache add the trailing slash automatically, do the following:

In apache.conf (generally /etc/apache/conf/apache.conf), under the Virtual Host section, add
ServerName yourservername.ext

Example (apologies to Jason for using his domain): ServerName http://www.devnetwork.net

Thanks

Posted: Thu Jun 26, 2003 12:17 pm
by jennifer
Thanks, I'll pass this on to the sysadmin & get back.