Jump to content

Manual:Short URL/LocalSettings.php

From mediawiki.org

This solution should pertain to everyone who uses Apache with MediaWiki installed directly within the directory (folder) that Apache uses to retrieve files for your website. The only thing you need to know before you get started is what your website address is and where your MediaWiki is installed. You may use this in combination with aliasing and/or rewrite rules.

Your website address may look like any of the follow:

  • subdomain.example.com/Page_Name
  • subdomain.example.com/wiki/Page_Name
  • subdomain.example.com/w/index.php?title=Page_Name&action=edit
  • subdomain.example.com/~user/Page_Name
  • subdomain.example.com/~user/wiki/PageName
  • subdomain.example.com/~user/w/index.php?title=Page_Name&action=edit

Options

[edit]

In order for your short addresses to work you will need to adjust some settings in LocalSettings.php :

Quick look at options
setting default value description
$wgScriptPath "/wiki" Where MediaWiki is installed
$wgScript "{$wgScriptPath}/index.php" Where MediaWiki's main script is located. Don't touch unless you've renamed and/or moved index.php
$wgArticlePath "{$wgScript}?title=$1", or "{$wgScript}/$1" (depends on value of $wgUsePathInfo) How article links internal to MediaWiki are constructed
$wgUsePathInfo false if php is running as a cgi module, true otherwise Whether to use pretty URLs like index.php/Page_title or not

All values are relative paths using the base URL of the website, and may refer to paths that are changed as a result of aliasing or rewrite rules. Under most cases you should only need to change three options:

with /wiki without /wiki
$wgScriptPath = "/w";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = false; # don't need prior to 1.11.x
$wgScriptPath = "/w";
$wgArticlePath = "/$1";
$wgUsePathInfo = false; # don't need prior to 1.11.x