[mod_python] Directory indexing problem

Richard Whitehurst richard.whitehurst at reputations.co.uk
Wed May 19 12:43:51 EDT 2004


I would be very grateful for any help on this - see setup below.

When requesting /www/python the handler follows the IF path correctly.
Subsequently, with the same request (cookie is detected and ELSE path followed),
I get 404 Not Found and in the error log I get "Attempt to serve directory: /www/python/",
although requesting /www/python/index.html is served up ok.

If I remove the handler from the config, /www/python is served up ok, so the handler seems to
be affecting the "DirectoryIndex index.html" directive.

<Directory /www/python>
    SetHandler python-program
    PythonHandler sshandler
</Directory>

def handler(req):
    if not req.headers_in.has_key('Cookie'):
        req.headers_out['location'] = '/services/codeofconduct.html'
        req.status = apache.HTTP_SEE_OTHER
        return apache.OK
    else:
        return apache.DECLINED

Best wishes
Richard

Using: RedHat ES 3, Apache 2.0.46, mod_python 3.0.3, Python 2.2.3



More information about the Mod_python mailing list