[mod_python] how do I eliminate the .py extension in url?

Jorey Bump list at joreybump.com
Thu Feb 10 23:52:14 EST 2005

Graham Dumpleton wrote:
> Jorey Bump wrote ..
>>This allows the type of URLs the OP desires. The only caveat that I'm
>>aware of is that you *must not* have similar names with different
>>extensions (foo.py, foo.php, foo.html, foo.jpg, etc.), or there will be
>>unexpected results when apache tries to guess which one to use.
>>versions: apache 1.3.x, mod_python 2.7.x
> Be warned that Apache 2.0 behaves a bit different to Apache 1.3.
> Specifically, mod_mime, mod_index and mod_dir in Apache 1.3 will
> actually look inside directories managed by a mod_python handler
> and fiddle with URLs and apply stuff like DirectoryIndex whereas
> in Apache 2.0 it doesn't. I feel that the Apache 2.0 behaviour is more
> correct, especially if you are using SetHandler and more or less expect
> to have almost total control. Your application might therefore not
> work as expected on Apache 2.0.

Thanks for the tip. You're right, on my Apache 2.x test server, I have 
to shut *off* MultiViews and use SetHandler instead of AddHandler to 
hide the .py extension. I guess Harry Nilsson was right ('Everything is 
the opposite of what it is, isn't it?')...

I imagine performance is better with MultiViews off, but I did like 
being able to mix different types of files in one directory by using 
AddHandler. Fortunately, my apps don't really depend on it.

More information about the Mod_python mailing list