首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用短URL引用带有Apache虚拟主机的MediaWiki站点

问使用短URL引用带有Apache虚拟主机的MediaWiki站点
EN

Stack Overflow用户
提问于 2021-12-30 11:31:59
回答 1查看 206关注 0票数 0

我在Apache上的设置:

  • /var/www/sandbox.example.org/wiki
  • I有一个从http://sandbox.example.org到https://sandbox.example.org的永久重写;Apache配置文件中有一个http配置文件和https配置文件
  • :DocumentRoot、/var/www/sandbox.example.org/wiki
  • In、Apache配置文件: DirectoryIndex index.php

我将Mediawiki放在/var/www/sandbox.example.org/wiki文件夹中,然后进行安装。

LocalSettings.php自动获得:$wgScriptPath = "";

作为浏览器中的URL,我得到:https://sandbox.example.org/index.php?title=MainPage

我想要的:https://sandbox.example.org/wiki/MainPage

我在https://www.mediawiki.org/wiki/Manual:Short_URL/Apache上遵循/尝试了指令,但没有效果。

怎么做?

EN

回答 1

Stack Overflow用户

发布于 2022-01-05 20:18:34

找到解决办法了!对于那些感兴趣的人:

在虚拟主机配置文件中,标记中有以下内容:

代码语言:javascript
复制
DocumentRoot /var/www/sandbox.example.org
DirectoryIndex w/index.php

RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]

在LocalSettings.php的MediaWiki安装中:

代码语言:javascript
复制
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;

所以现在我有了:http://sandbox.example.org/wiki/MainPage而不是http://sandbox.example.org/w/index.php?title=MainPage。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70531035

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档