Short url of Mediawiki

NeilZhang
NeilZhang
管理员
140
文章
106.8千
浏览
Linux评论244字数 177阅读0分35秒阅读模式

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.

 
  • 本文由 NeilZhang 发表于11/12/2017 01:28:31
  • Repost please keep this link: https://www.dbcloudsvc.com/blogs/linux/short-url-of-mediawiki/
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定