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

Graham Dumpleton grahamd at dscpl.com.au
Thu Feb 10 19:23:04 EST 2005


Jef Dodson wrote ..
> Also, it's not a very general solution.  I would like to be able to access
> any number of scripts
> without having the .py show up in the URL.  I am sure it is possible because
> I had it working
> under Linux, but I am now trying to get it working under BSD so I'm wondering
> if maybe there is
> some option that I'm missing in my httpd config file that was there by
> default on the Linux
> installation.  Anyone have any ideas on this?

Make sure you turn off MultiViews. Add to your .htaccess file:

  Options -MultiViews

Alternatively, don't set it in the first place in the main Apache configuration
for that directory. Turning this off in a .htaccess file will require you to have
appropriate rights to do so.

You should then be able to avoid using a .py extension if configuring use of
publisher as:

  SetHandler python-program

This cannot be done if you used:

  AddHandler python-program .py

The MultiViews option can cause lots of problems when using mod_python and
is frankly better always turned off.

Graham


More information about the Mod_python mailing list