Note that there are some explanatory texts on larger screens.

plurals
  1. POUnwanted Apache redirect from directory to file with same name
    text
    copied!<p>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:</p> <p>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.</p> <ul> <li>File located at <em>www.example.com/contact.form.php</em></li> <li>CMS content located at <em>www.example.com/contact/contact-us</em></li> </ul> <p>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.</p> <p>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.</p> <p>The work-arounds I've come up with so far:</p> <ul> <li>Change the filename to form.contact.php -- which disables any CMS content that may eventually exist in <em>www.example.com/form/...</em></li> <li>Create an empty directory at <em>www.example.com/contact/</em></li> </ul> <p>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.</p> <p>I've searched with all kinds of keyword combinations, and I can't find the answer anywhere. Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload