Short url of Mediawiki

  • Read

When I changed my domain name, I planed three subdomains for the future usage: www, blogs and wiki, while unfortunately at that time only the had some contents and in fact it was migrated from previous

Now I have installed the Mediawiki and the is online, so the first thing I want to do is about the permanent link, or short url in Mediawiki world.

Need the following two steps:

  1. Update the file LocalSettings.php
    [root@www wiki]# diff LocalSettings.php*
    < $wgArticlePath = "/$1";
    < $wgUsePathInfo = true;
    [root@www wiki]# ls LocalSettings.php*
    LocalSettings.php  LocalSettings.php.bak
  2. Add the rewrite rule for Mediawiki in the nginx configuration file
    # MediaWiki Rewrite
    if ($host = {
    set $nrw W;
    if (!-e $request_filename) {
    set $nrw "${nrw}Y";
    if ($nrw = WY) {
    rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last;

For me, www and wiki subdomains share the same configuration file, so I have to check which one is accessed.

And I began to write my first installation page on the wiki.

  • by Published on 11/12/2017 01:28:31
  • Repost please keep this link:


Anonymous Write

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: