Change MediaWiki subpath

From SaruWiki
Jump to navigation Jump to search

Change MediaWiki pathname

By default, the MediaWiki instance will appear on your site in a subdirectory of your main site, e.g. http://www.saruman.biz/mediawiki. This is not always what you want. If you want a different path name, e.g. just "wiki", or maybe even "foobar", you'll have to make two changes:

  • You'll have to change the apache.conf file that by default is in /etc/mediawiki - and that'll have moved to /etc/mediawiki/<instancename> if you've followed the instructions to creat a wikifarm. In it, you find an Alias line that you'll have to change; in the case of a change from /mediawiki to /foobar to
Alias /foobar /var/lib/mediawiki
  • You'll also have to change a line in LocalSettings.php which should be in the same location as apache.conf. The line defines the path name for all PHP scripts to use, so in the case of a change from /mediawiki to /foobar, it becomes
$wgScriptPath       = "/foobar";

Naturally, you'll have to restart your Apache2 webserver in order to effectuate the changes.