I believe I’m looking for the Apache setting or mod that accomplishes this behavior because I need to turn it off or alter it in some fashion. Here’s the deal:
I have my own CMS that has its own router to handle redirects, includes, 404 errors, and pretty URLs. The mod_rewrite rules work perfectly to direct the appropriate requests to this router, but there’s a strange case that causes Apache to freak out and never even send the request to the router.
- File located at http://www.example.com/contact.form.php
- CMS content located at http://www.example.com/contact/contact-us
Requests for the CMS content should be going to the router because it does not match a file or directory that exists in the file system. What is actually happening is some sort of bizarre request that finds the contact.form.php file but somehow still causes Apache to give its own 404 error.
The router is designed to catch 404 errors, so Apache’s 404 screen should never be seen. All URLs entered for this domain outside of the contact “directory” (no matter how absurd) make it to my router and either retrieve the correct content or show my 404 page.
The work-arounds I’ve come up with so far:
- Change the filename to form.contact.php — which disables any CMS content that may eventually exist in http://www.example.com/form/…
- Create an empty directory at http://www.example.com/contact/
The conflict is clearly tied to the “directory” name matching the first part of a PHP filename. This behavior exists any time this condition is met, and it is non-existent when it is not met. Unfortunately, with a CMS, I can never guarantee that “directory” names won’t collide with PHP file names. For this reason, my focus is on tweaking Apache.
I’ve searched with all kinds of keyword combinations, and I can’t find the answer anywhere. Any ideas?
Found the answer elsewhere after a lot of searching.
The problem is Options MultiView is turned on.
For me, I am using virtual hosts, but I am configuring most of my settings in the user.conf file for apache on Mac OSX Lion. I am not sure if I added this, or if it was already there…
Here is what I did
Alternatives
You can add Options -MultiViews if you don’t see anything there.
Also you can edit your httpd.conf file if the above does not apply.
And if you use virtual hosts, you can edit your httpd-vhosts.conf file. For each site, edit the MultiViews Option within the tags. Either by adding “Options -MultiViews” or removing “Options MultiViews” if it exists.
Hope this helps somebody else…