[Moin-user] mod_rewrite and mod_python

Robert Schumann robert at cantab.net
Wed Mar 22 18:27:02 EST 2006


I've been stuggling with a small but annoying problem for a few hours.

I've set up Moin 1.5.2 on Apache 2.0.54 (Ubuntu) using mod_python and 
mod_rewrite.  My own particular flavour of RewriteRule is slightly 
different than that advertised on MoinMoin wiki: it checks to see if a 
requested file really exists in the filesystem, and if it doesn't then 
it passes the request to Moin.

It works fine, except for directories.  If someone types in 
http://wiki.example.com/ then I would obviously like them to get to the 
FrontPage; currently, they are sent to a wiki page entitled index.html.  
Same if I try http://wiki.example.com/htdocs/modern, I just end up being 
shown a wiki page called htdocs/modern/index.html.

Does anyone know how to prevent Apache from appending index.html to 
everything?  My apache config is shown below (including some of my 
attempts to remove the DirectoryIndex).

Thanks for your help,

Robert.
--------------------------------------------------------------------------------

<VirtualHost *:80>
        ServerName wiki.example.com

        # Rewrite urls
        RewriteEngine On
        RewriteLogLevel 2

        DocumentRoot /srv/example/public_html
        # If the request is not for a valid directory...
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
        # ...and it's not for a file...
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
        # ...then pass the path from the URL to moin
        RewriteRule ^(.*)$ /srv/moinfiles/server/moinmodpy.py/$1 [last]
        # Of course, if the user just typed http://example.com/,
        # that needs to work too!
        RewriteRule ^$ /srv/moinfiles/server/moinmodpy.py [last]

        <Directory "/srv/moinfiles/server">
                AllowOverride None
                Options None
                Order allow,deny
                Allow from all

                AddHandler python-program .py
                PythonPath "['/srv/moinfiles', '/srv/moinfiles/server'] 
+ sys.path
                PythonHandler moinmodpy
                PythonDebug On
        </Directory>

       <Directory />
#               Options FollowSymLinks -Indexes
                Options None
                DirectoryIndex ""
               AllowOverride None
       </Directory>

</VirtualHost>
----------------------------------------------------------




More information about the Moin-user mailing list