I'm trying to enable the use of the + character in article titles in
MediaWiki while retaining the use of clean URLS provided by mod_rewrite.
For clean URLs, one needs to rewrite a URL of
/wiki/(articlename)
to
/(path)/index.php?title=(articlename).
The problem I run into is that the character + gets dropped from URLs.
such that
/wiki/C++
ends up presenting a user with the article and URL
/wiki/C
Clearly an error. I've found that by navigating to
/wiki/C%2B%2B
I get an article title of C++. However, I have been unable to come up
with a RewriteRule that would replace occurances of + in the URL with
%2B. (C++ isn't the only article that would end up having + in the
title; there's also Gtk+. I imagine there would eventually be more.)
My current rewrite rules are thus:
(start)
RewriteEngine on
RewriteRule ^$ /wiki/Main_Page [R]
RewriteRule ^wiki/Special:Blog$
http://blog.rosettacode.org/
[R=permanent,L]
RewriteRule ^wiki/?(.*)$ /rosettacode/w/index.php?title=$1 [L,QSA]
(end)
(You can probably ignore the RewriteRule for the blog...It is included
only for completeness.)
I've tried the following rules: (one at a time, of course.)
RewriteRule \+ %2B
RewriteRule (.*)\+(.*) $1%2B$2
RewriteRule (.*)\+(.*) $1\%2B$2
and even
RewriteRule (.*)\+(.*) $1$2
All I get from my rules are recursive replacement behaviors or, failing
that, HTTP 500 errors.
One final note: The production server (run by someone else; I'm a
gracious guest.) runs Apache 1.3. The test server (my laptop) runs
Apache2. Getting Apache 1.3 running on my Ubuntu laptop (to match the
server specs) would be difficult.
Can someone tell me what I'm doing wrong, and perhaps give me a shove in
the right direction?
--
Rosetta Code -- Building a Rosetta Stone for Programmers
http://rosettacode.org