Click to See Complete Forum and Search --> : Strange file serving


chickenland
02-27-2006, 08:02 AM
Probably more a question to do with Apache ?

I was mucking about with mod-rewrite the other day, and then decided to turn it all off in the http.conf and delete the .htaccess file. (i'm runnning a localhost on my machine).

There has been a strange side-effect... now for example, if i wanted contact.php to appear, typing contact, contact.php or contact/ all bring up the file - obviously, i should be getting 404s.

I've reset the http.conf file, but as soon as i put php into the http.conf, it starts doing it again. Its also affecting the whole of my htdocs folder.

Any ideas ?

edit : In a strange twist to this, i reverted to the http.default.conf and checked, and other file types seem to be exhibiting the same process. for example /content.jpg /content /content.j all call the same file...

Scleppel
02-27-2006, 09:43 AM
It could be MultiViews (http://httpd.apache.org/docs/2.0/mod/mod_negotiation.html#multiviews).

To stop it, you have to set -MultiViews for the Options of your root directory. Somewhere in your httpd.conf file you should have a block of code like this:
<Directory "/path/to/your/htdocs">
# the other options don't matter
# you just need -Multiviews
Options Indexes FollowSymLinks -MultiViews
# some other stuff here
</Directory>

bokeh
02-27-2006, 12:29 PM
To be honest this is a very handy behaviour once you get used to it. It allows URLs without the need for a file extention.

chickenland
02-28-2006, 04:50 AM
It could be MultiViews (http://httpd.apache.org/docs/2.0/mod/mod_negotiation.html#multiviews).

To stop it, you have to set -MultiViews for the Options of your root directory. Somewhere in your httpd.conf file you should have a block of code like this:
<Directory "/path/to/your/htdocs">
# the other options don't matter
# you just need -Multiviews
Options Indexes FollowSymLinks -MultiViews
# some other stuff here
</Directory>

Awesome, cheers :) I had set -MultiViews, but it was later declared again as MultiViews, so it must have been over-riding it. Thanks.


To be honest this is a very handy behaviour once you get used to it. It allows URLs without the need for a file extention.

Do people expect this from apache ? Is it that it does it by default and i've just never noticed it ?

I'd have used mod_negotiation (http://httpd.apache.org/docs/1.3/mod/mod_negotiation.html) to get the same effect...