Apache "guessing" at files that don't exist?

Apache "guessing" at files that don't exist?

Posted by: everinjoy
Posted on: 2006-02-17 08:58:00

We're having this weird problem where if you type a URL for a page like: "http://www.domain.com/somepage" it looks for somepage.txt, then somepage.html, and finally somepage.php -- even though "somepage" with no extension *doesn't exist*, it shows up! It's not a straight redirect, either, because it doesn't change the URL. We want it to return 404s when the requested file doesn't exist, not search around for a file that looks like the right one! The first thing I thought was that perhaps it had something to do with mod_rewrite, but turning off mod_rewrite had no affect -- the behavior continued. Anyone know anything else that can cause this?


Posting this in off-topic because the server in question is on-site (Mac Xserve) where I work, not DH. :-) I thought it wouldn't hurt to try, though -- really at my wits' end here! Thanks for any help you can offer.

Re: Apache "guessing" at files that don't exist?

Posted by: kchrist
Posted on: 2006-02-17 09:27:00

It sounds like you're using mod_negotiation.

I don't recall if Apache on OS X has it enabled by default, but if you don't want it you can either comment out the module lines in /etc/httpd/httpd.conf (be sure you get both the LoadModule and AddModule lines) or disable it on a per-virtualhost or per-directory basis with the following line in your VirtualHost container or .htaccess file, respectively:

Options -MultiViews

Personally, I find it useful and always enable it on my sites.

Re: Apache "guessing" at files that don't exist?

Posted by: everinjoy
Posted on: 2006-02-17 09:52:00

Thank you sooooo much! That was exactly what it was, and it worked perfectly! I really, really appreciate it. :-)

Tags: weird problemmodwww domainurlwits endredirecttxtapachephphtmlhttp