User:Barrylb/Fix for ampersand in titles

Because of URL Rewrites, ampersands (&) appear in the wiki page title as &amp;amp;.

Below Apache 2.0
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. (As of 2005, 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

Patching without Apache
If an editor does not have the ability to patch Apache like Wikipedia's solution, try this solution which modifies the MediaWiki code to extract the title from the $_SERVER variable. [WHERE?]

This is tested and working on 1.6.7.

Modify includes/WebRequest.php - function WebRequest - put the following after : global $wgArticlePath; if (strpos($_SERVER['SCRIPT_NAME'], 'index.php') === false) { $articlePathPart = str_replace('$1','',$wgArticlePath); $_GET['title'] = $_REQUEST['title'] = str_replace($articlePathPart, '', $_SERVER['SCRIPT_NAME']); }