MediaWiki URLs and ampersands (&)

MediaWiki URLs and ampersands (&)

Posted by: austicke
Posted on: 2005-08-13 19:45:00

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?

In reply to:

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".



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

Re: MediaWiki URLs and ampersands (&)

Posted by: austicke
Posted on: 2005-08-16 20:05:00

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

Drat.

Tags: urlsmediawiki