Forum Moderators: phranque

Message Too Old, No Replies

Curious url rewrite behavior

         

Penguinsushi

2:58 pm on Jun 13, 2011 (gmt 0)

10+ Year Member



Hey all -

I have what may or may not be an obvious question/issue. A while back I discovered an interesting behavior of a web server (linux/apache) on which I have a shared hosting account. Namely, *directory* requests that reference non-existent directories will return like-named *files* if those do exist.

Example:

A call to the non-existent directory www.domain.com/page/ will instead serve the existent page www.domain.com/page.php.

I am wondering exactly why this occurs as opposed to returning a simple 404...

Thanks,

~PS

lucy24

10:20 pm on Jun 13, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



One possibility: MultiViews [httpd.apache.org] using mod_negotiation:
If the server receives a request for /some/dir/foo and /some/dir/foo does not exist, then the server reads the directory looking for all files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements, and returns that document.