Re: mod_rewrite madness
"Michael Mol" <mikemol@gmail.com> schreef in bericht
news:eqdmjo$5h4$1@aioe.org...
> 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++.
The + sign is an shorthand in URLencoding replacing %20 aka space.
The literal + should be encoded %2B indeed
Be aware the link you type into the navbar and a link found in a <a
href='...'tag is NOT handled identical by the browser. <a href=C++> will be
encoded to C%2B%2B, while typing C++ is the navbar yourself is not encoded.
Unfortunately Apache thinks the latter has two shorthand encoded trailing
spaces to be decoded.
> However, I have been unable to come up with a RewriteRule that would
> replace occurances of + in the URL with %2B.
The rule is fed the unencoded URL where the + is replaced by a space
C# is your next stopper ...
HansH
|