Apache loads any file that begins with the same string as used in url. How to prevent this?

Posted by MarshallBananas on Stack Overflow See other posts from Stack Overflow or by MarshallBananas
Published on 2010-04-23T10:23:07Z Indexed on 2010/05/04 20:38 UTC
Read the original article Hit count: 226

Filed under:
|
|
|

If I point to:

mywebsite.com/search

and there is a file called search.php or search.html or search.inc.php or search.whatthehell.php in website's directory, Apache will point to that file instead of 404'ing.

What is even more annoying is that if I point to:

mywebsite.com/search/string?also=whatever

Apache will still display any file with filename that begins with "search.".

Also, all RewriteRules with patterns containing filenames existing in directory are ignored/useless.

I'm using Apache 2 on Mac, unmodified httpd.conf. How do I prevent it from redirecting my urls so freely?

© Stack Overflow or respective owner

Related posts about apache

Related posts about httpd.conf