[mod_python] trouble with mod_python from public_html directory

Jeff jam at quark.emich.edu
Sun May 28 13:53:01 EST 2000


I'm having difficulty figuring out this problem, and I'm hoping someone will
be able to help get it resolved. I'm not sure if this is a problem with
mod_rewrite or mod_python or my configuration of them.

I have the following .htaccess file in /home/jam/public_html:
[~/public_html] [1:35pm] [jam at toast-pts/2] % cat .htaccess 
AddHandler python-program .py
PythonHandler cgihandler
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)\.html$          $1.py   [L]

The intent of the rewrite rule is if the URL requests a file ending in
.html, it will check first to see if that file exists (and send it as normal
if it does), and if a suitable file does *not* exist, check for a .py
extension and run that via mod_python if it does.

The above set of directives works *fine* if I install it in
/home/httpd/html.. I can request 'index.html' and it will run the 'index.py'
module I've created.

The problem starts when I copy the .htaccess file to my home directory, and
try to get the same thing to work. it doesn't. I get the following error in
the /var/log/httpd/error_log file: [Sun May 28 13:36:02 2000] [error]
[client] File does not exist:

This indicates the reason for the error-- it's looking for a file called
"/home/httpd/html/home/jam/public_html/index.py", which clearly doesn't
exist (it should instead be "/home/jam/public_html/index.py").

This error occurs regardless of the existence of a .htaccess file in
/home/httpd/html-- I had thought that might be part of the problem, so at
first I added a "PythonInterpPerDirectory" directive, and then renamed the
file so it wouldn't be used, and tried again-- no luck.

I'm not sure if I need to present more information before this problem can
be solved.. please let me know if I can answer any questions about the setup
that might point me in the right direction.

Thanks in advance ;)

|| visit gfd <http://quark.emich.edu/>
|| psa member -- <http://www.python.org/psa/> 

More information about the Mod_python mailing list