[英]Use short URL to refer to MediaWiki site with Apache virtual host
My setup on Apache:我在 Apache 上的设置:
I put Mediawiki in the /var/www/sandbox.example.org/wiki folder and then did the installation.我将 Mediawiki 放在 /var/www/sandbox.example.org/wiki 文件夹中,然后进行安装。
LocalSettings.php got automatically: $wgScriptPath = ""; LocalSettings.php 自动获取:$wgScriptPath = "";
As URL in the browser, I get: https://sandbox.example.org/index.php?title=MainPage作为浏览器中的 URL,我得到: https://sandbox.example.org/index.php?title=MainPage
What I want: https://sandbox.example.org/wiki/MainPage我想要什么: https://sandbox.example.org/wiki/MainPage
I followed / tried instructions on https://www.mediawiki.org/wiki/Manual:Short_URL/Apache , but with no effect.我按照/尝试了https://www.mediawiki.org/wiki/Manual:Short_URL/Apache上的说明,但没有效果。
How to do this?这个怎么做?
Found the solution: For the ones who are interested:找到了解决方案:对于那些感兴趣的人:
In the virtual host configuration file, there is among others within the <VirtualHost *:80> tag:在虚拟主机配置文件中,<VirtualHost *:80> 标记内还有其他内容:
DocumentRoot /var/www/sandbox.example.org
DirectoryIndex w/index.php
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
And in the LocalSettings.php of the MediaWiki installation:在 MediaWiki 安装的 LocalSettings.php 中:
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
So now I have: http://sandbox.example.org/wiki/MainPage instead of http://sandbox.example.org/w/index.php?title=MainPage .所以现在我有: http://sandbox.example.org/wiki/MainPage而不是http://sandbox.example.org/w/index.php?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.