我在Apache上的设置:
- /var/www/sandbox.example.org/wiki
- 我有一个从http://sandbox.example.org到https://sandbox.example.org;有一个http配置文件和一个https配置文件
- 在Apache配置文件中:DocumentRoot/var/www/sandbox.example.org/wiki
- 在Apache配置文件中:DirectoryIndex index.php
我把Mediawiki放在/var/www/sandbox.example.org/wiki文件夹中,然后进行安装。
LocalSettings.php自动获得:$wgScriptPath="quot;;
作为浏览器中的URL,我得到:https://sandbox.example.org/index.php?title=MainPage
我想要什么:https://sandbox.example.org/wiki/MainPage
我遵照/尝试了https://www.mediawiki.org/wiki/Manual:Short_URL/Apache,但没有效果。
如何做到这一点?
找到了解决方案!对于感兴趣的人:
在虚拟主机配置文件中,在<虚拟主机*:80>标签:
DocumentRoot /var/www/sandbox.example.org
DirectoryIndex w/index.php
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
在MediaWiki安装的LocalSettings.php中:
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
所以现在我有:http://sandbox.example.org/wiki/MainPage而不是http://sandbox.example.org/w/index.php?title=MainPage.