Hello!
I know this must be something simple, but I really can't figure it out. I have what I believe a quite standard setup with mediawiki 1.9.3. My .htaccess is basically:
RewriteRule ^wiki/?(.*)$ /mediawiki/mediawiki-1.9.3/index.php?title=$1 [L,QSA] RewriteRule ^w/?(.*)$ /mediawiki/mediawiki-1.9.3/$1 [L,QSA]
and LocalSettings.php has:
$wgScriptPath = "/w"; $wgScript = "$wgScriptPath/index.php"; $wgRedirectScript = "$wgScriptPath/redirect.php"; $wgArticlePath = "/wiki/$1";
Everything worked like a charm, until a user of my site created a page about C++.
The page is there (i.e. accepted by MW and in the DB), but if I try to load it I get a missing page error because the two + are gone. If I type two %2B in the location bar of the browser (Firefox) I get nothing.
If I type two %252B: BUM! I get my page.
If I remove the RewriteRule(s) and change my LocalSettings.php to standard values, everything works: the pages are loaded without any need of typing %252B.
I simply CANNOT find any info, idea, hint, suggestion about this stuff, and I'm stuck.
Please, throw me a bone here, people. Throw me a bone, please.
Thanks. M
Ing Informazione wrote:
Hello!
I know this must be something simple, but I really can't figure it out. I have what I believe a quite standard setup with mediawiki 1.9.3. My .htaccess is basically:
RewriteRule ^wiki/?(.*)$ /mediawiki/mediawiki-1.9.3/index.php?title=$1 [L,QSA] RewriteRule ^w/?(.*)$ /mediawiki/mediawiki-1.9.3/$1 [L,QSA]
Plus signs don't work with path-to-query rewrite rules. This has been known and documented for years. It is the reason Wikipedia did not originally allow plus signs in titles. The way to avoid the problem is to not use path-to-query rewrite rules, there is no other workaround.
Apparently it wasn't documented in the right places, because people keep asking, so let me paste the whole comment here from DefaultSettings.php, for the benefit of the archives.
-------------------------------------------------------------------------
Allowed title characters -- regex character class Don't change this unless you know what you're doing
Problematic punctuation: []{}|# Are needed for link syntax, never enable these <> Causes problems with HTML escaping, don't use % Enabled by default, minor problems with path to query rewrite rules, see below + Enabled by default, but doesn't work with path to query rewrite rules, corrupted by apache ? Enabled by default, but doesn't work with path to PATH_INFO rewrites
All three of these punctuation problems can be avoided by using an alias, instead of a rewrite rule of either variety.
The problem with % is that when using a path to query rewrite rule, URLs are double-unescaped: once by Apache's path conversion code, and again by PHP. So %253F, for example, becomes "?". Our code does not double-escape to compensate for this, indeed double escaping would break if the double-escaped title was passed in the query string rather than the path. This is a minor security issue because articles can be created such that they are hard to view or edit.
In some rare cases you may wish to remove + for compatibility with old links.
Theoretically 0x80-0x9F of ISO 8859-1 should be disallowed, but this breaks interlanguage links.
mediawiki-l@lists.wikimedia.org