MediaWiki URLs and ampersands (&)



Has anyone used the apache-ampersand.diff patch to fix ampersands in MediaWiki short URLs? I’ve never used shell access, but I guess I’d need to for this. Any thoughts?

[quote]If you’re using URL rewriting and want to be able to use the ampersand (&) in page titles, you’ll need to patch Apache to properly escape the character when generating the query string. A patch for Apache 1.3.26 is available as maintenance/apache-ampersand.diff in the MediaWiki source. (No patch is yet available for Apache 2.0.x.)

Change your mod_rewrite config like so:

RewriteEngine On
RewriteMap ampescape int:ampescape
RewriteRule ^/wiki/(.*)$ /w/wiki.phtml?title=${ampescape:$1} [L]
RewriteRule ^/wiki$ /w/wiki.phtml

This way, /wiki/AT&T correctly becomes /w/wiki.phtml?title=AT&T instead of /w/wiki.phtml?title=AT&T, which breaks up into “title=AT” and a useless “T”.[/quote]

Well, the % 26 doesn’t show properly in the above quote, but that’s what it’s doing – changing & to % 26.

Alec Usticke
DreamHost referral


Support says “Unfortunately, we do not support this at this time, nor do we allow users to patch apache them selves.”


Alec Usticke
DreamHost referral