跳到主要内容

短网址

说明:去掉 index.php?title=,实现短网址

Nginx

location / {
try_files $uri $uri/ /index.php?$query_string;
}

Apache

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?title=$1

公共

编辑 LocalSettings.php

$wgScriptPath = ""; 
$wgArticlePath = '/$1';
$wgScriptExtension = ".php";

这三行的解释

第一行,我的脚本路径是网址:https://wiki.kunyan.li/index.php,如果是 https://wiki.kunyan.li/wiki/index.php,改为 $wgScriptPath = "/wiki";

第二行,我设置为 https://wiki.kunyan.li/首页,不是 https://wiki.kunyan.li/wiki/首页,否则,填写 /wiki/$1

第三行,脚本扩展名 .php

参考