User:Barrylb/Fix for ampersand in titles

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
Fix for ampersand in titles

Release status: unknown

Implementation User interface
Description When you are using Apache mod_rewrite to make friendly URLS it screws up ampersands in titles. If you do not have the ability to patch Apache like Wikipedia's solution, try my solution which modifies the MediaWiki code to extract the title from the $_SERVER variable.
Author(s) Barrylb
MediaWiki 1.6.7
License No license specified
Download No link


When you are using Apache mod_rewrite to make friendly URLS it screws up ampersands in titles. If you do not have the ability to patch Apache like Wikipedia's solution, try my solution which modifies the MediaWiki code to extract the title from the $_SERVER variable. Tested and working on 1.6.7.

Modify includes/WebRequest.php - function WebRequest() - put the following after global $wgUsePathInfo;:

  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']); 
  }

Barrylb 19:37, 17 July 2006 (UTC)

Language: English  • Русский
Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox