[Moin-devel] MoinMoin with Apache mod_rewrite

Alexander Anderson alex at upful.org
Sat Dec 15 09:09:02 EST 2001


Greetings,

I'm going to tell how I used mod_rewrite to shorten URL's
from:   http://www.example.com/cgi-bin/moin/moin/FrontPage
to:     http://www.example.com/FrontPage


Step 1.

I used this rewrite rule:
RewriteRule     ^/(.*)  /cgi-bin/moin/moin/$1    [PT]

Step 2.

I changed SCRIPT_NAME environmental variable in "moin_config.py"
as follows:

#v+
===================================================================
RCS file: RCS/moin_config.py,v
retrieving revision 1.1
diff -u -r1.1 moin_config.py
--- moin_config.py	2001/12/15 15:46:48	1.1
+++ moin_config.py	2001/12/15 16:50:21
@@ -6,7 +6,12 @@
 
     $Id: moin_config.py,v 1.1 2001/12/15 15:46:48 root Exp root $
 """
+
+import os
+
 __version__ = "$Revision: 1.1 $"[11:-2]
+
+os.environ['SCRIPT_NAME'] = ""
 
 # basic options
 data_dir = './data/'
#v-

As far as I could observe, SCRIPT_NAME is prepended to every internal link
by MoinMoin. This is how it's done.

And now the question to the developers and hackers: could I have broken
something (that I didn't notice yet) by unsetting SCRIPT_NAME variable?

Thank you ladies and gentlemen.




More information about the Moin-devel mailing list