[mod_python] SetHandler trick to have pretty url's

courtney ludwin courtneyludwin at yahoo.com
Tue Jan 10 01:52:05 EST 2006

I was looking for a way to pretty up my mod_python
url's the other day and I figured out a trick that
works w/ the 'FilesMatch' directive in httpd.conf, I
figure I'd share with the list....

 <FilesMatch "(^[^\.]*$|^[^\?]*[\?]+[^$]+$)">
    SetHandler python-program
    PythonHandler common.dispatch.dispatcher
    PythonDebug On

This match expression says anything without a file
extension should be handled by dispatcher.py otherwise
apache should handle it normally.  I wrote the
dispatcher use a config file to map url's to
mod_python handlers.

Followed up a quick example in my blog:

Hope you find it useful.


Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 

More information about the Mod_python mailing list