[mod_python] SetHandler trick to have pretty url's

Graham Dumpleton grahamd at dscpl.com.au
Tue Jan 10 04:25:18 EST 2006


On 10/01/2006, at 8:14 PM, Graham Dumpleton wrote:

>
> On 10/01/2006, at 5:52 PM, courtney ludwin wrote:
>
>>  <FilesMatch "(^[^\.]*$|^[^\?]*[\?]+[^$]+$)">
>>     SetHandler python-program
>>     PythonHandler common.dispatch.dispatcher
>>     PythonDebug On
>>   </FilesMatch>
>
>   SetHandler python-program
>   PythonHandler common.dispatch.dispatcher
>   PythonDebug On
>
>   <Files *.*>
>   SetHandler None
>   </Files>

BTW, I should point out that both of these techniques are actually
dangerous to use if you keep your Python code for your handler in
the same directory. That is because your .py and .pyc files are
accessible for people to download. Always a good idea to also use:

   <Files "*.py">
   deny from all
   </Files>
   <Files "*.pyc">
   deny from all
   </Files>

Or similar obscure regular expression which catches both at the
same time.

Graham



More information about the Mod_python mailing list