Apache downloads any file that starts on the same line as in the url. How can you prevent this?

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 the website directory, Apache will point to that file instead of 404'ing.

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

mywebsite.com/search/string?also=whatever

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

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

I am using Apache 2 on Mac, unmodified httpd.conf. How can I prevent my urls from being redirected so freely?

+2


a source to share


1 answer


You will have to disable the MultiViews option using the Directive option. This is a function of the apache content negotiation module, so if you are not using mod_negotiation you can simply unload it.

http://httpd.apache.org/docs/2.0/content-negotiation.html

An 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

+2


a source







All Articles