[Moin-devel] [PATCH] Small kluge for easier mod_rewrite integration
Malte S. Stretz
msquadrat.nospamplease at gmx.net
Sun Oct 17 09:04:02 EDT 2004
And hello again,
as the url_mappings feature didn't do what I intended to do -- have a user
website transparently fed from a Wiki like <http://example.com/WikiSandBox>
but only with .htaccess so no ScriptAlias possible -- I tried to tell Moin
which root it should use. According to the hack posted in [1] and the
unanswered question on [2] does one have to do some patching to get that to
work.
With some black mod_rewrite magic it's possible to feed the script a
different SCRIPT_NAME; unfortunately does the rewrite process prepend the
string REDIRECT_ to the environment variable. The attached patch makes
moin.cgi use that var if its defined.
This works for me with the following .htaccess:
| RewriteEngine On
| RewriteBase /~mss
|
| # The *-bin directories (like cgi-bin, wiki-bin, image-bin, ...) shall not
| # be touched by any following rewriting rules.
| RewriteCond %{REQUEST_URI} /[a-z]+-bin/
| RewriteRule ^ - [last]
|
| # Now the Wiki-rewriting...
| #
| # Strip trailing slashes -- they are good for directories but not for Wiki
| # names.
| RewriteRule ^(.*)/(\?.*)?$ $1$2 [last,redirect=permanent]
| # Transparent access to the Wiki pages; set the SCRIPT_NAME environment
| # variable so moin.cgi know where to link to.
| RewriteRule ^(.*)$ cgi-bin/moin.cgi/$1 [env=SCRIPT_NAME:/~mss]
I guess the even cleaner solution would be to introduce a new config
variable like wiki_prefix -- but for now the attached solution was easier
to implement for somebody like me who doesn't know much about Python and
even less about the MoinMoin internals :)
Cheers,
Malte
[1]http://sourceforge.net/mailarchive/forum.php?thread_id=15110&forum_id=623
[2]http://moinmoin.wikiwikiweb.de/MoinMoinQuestions
--
[SGT] Simon G. Tatham: "How to Report Bugs Effectively"
<http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>
[ESR] Eric S. Raymond: "How To Ask Questions The Smart Way"
<http://www.catb.org/~esr/faqs/smart-questions.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: moin-1.3-script_name.patch
Type: text/x-diff
Size: 640 bytes
Desc: Patch against request.py
URL: <http://mail.python.org/pipermail/moin-devel/attachments/20041017/24108a03/attachment.patch>
More information about the Moin-devel
mailing list