Short url of Mediawiki

  • 244 views
  • 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 blogs.dbcloudsvc.com had some contents and in fact it was migrated from previous www.lunixdb.com.

Now I have installed the Mediawiki and the wiki.dbcloudsvc.com 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*
    29,30d28
    < $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 = wiki.dbcloudsvc.com) {
    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: https://www.dbcloudsvc.com/blogs/linux/short-url-of-mediawiki/
匿名

Comment

Anonymous Write

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

Decide