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开发者_如何学JAVA 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?
You will have to disable MultiViews option using Options directive. This is a feature of the apache content negotiation module, so if you don't use mod_negotiation you can just unload it.
http://httpd.apache.org/docs/2.0/content-negotiation.html
Example of how to disable MultiViews for the /var/www directory:
<Directory /var/www/>
Options Indexes FollowSymLinks -MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
http://httpd.apache.org/docs/2.0/mod/mod_negotiation.html#multiviews
精彩评论