recursive tree problem with php vs html

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
jennifer
Forum Newbie
Posts: 2
Joined: Wed Jun 25, 2003 4:24 pm
Location: Alaska

recursive tree problem with php vs html

Post 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!
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post 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
User avatar
jennifer
Forum Newbie
Posts: 2
Joined: Wed Jun 25, 2003 4:24 pm
Location: Alaska

Thanks

Post by jennifer »

Thanks, I'll pass this on to the sysadmin & get back.
Post Reply