When I ask the server for an URL which has no extension, but is not a directory, apache automatically adds a .php extension to it. Where is this behavior configured?
EDIT: I'm sorry, my question wasn't clear: I'm not asking how to do this, I just found out that my local server (Apache/2.2.11 on Debian) does it by itself (i.e. I have no rewrite rules) and I wanted to know where this can be configured.
Debian (speaking current versions as you mention Apache 2.2.11 which falls somewhere between Lenny and Sid) has the
MultiViews
option enabled for/var/www
and/usr/share/doc
directories by default in/etc/apache2/sites-enabled/000-default
. With this option enabled Apache will attempt to match a URI request to any file with an extension it knows about. That said if the URI is requesting/test
it will attempt things liketest.php
,test.html
,test.txt
, etc until it finds a match.There's a few ways to do this. I'd use a mod_rewrite approach: