我已经安装了MediaWiki 1.27.1并设法让基本的单维基设置正常工作。现在我根据Manual:Wiki_family的说明尝试将其更改为wiki系列。这就是我的目标:
wiki.mysite.com/ #public wiki
wiki.mysite.com/priv1 #private wiki 1
wiki.mysite.com/priv2 #private wiki 2
我得到的结果:
wiki.mysite.com
按预期显示公共wiki。
wiki.mysite.com/priv1
返回404
wiki.mysite.com/priv2
返回404
[编辑:添加消息文本] 404消息的文本:
Not Found
The requested document was not found on this server.
Web Server at mysite.com
我做了什么:
我按照手册中列出的步骤,生成了LocalSettings.php的3个副本,并重命名了它们。然后我将主要的LocalSettings.php修改为以下内容:
<?php
if ( !defined( 'MEDIAWIKI' ) ) {
exit;
}
## Database settings - cut-and-pasted out from the 3 sub-wikis' LocalSettings.php
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "db_wiki";
$wgDBuser = "db_wiki_user";
$wgDBpassword = "password";
$callingurl = strtolower( $_SERVER['REQUEST_URI'] ); // get the calling url
if ( strpos( $callingurl, '/priv1' ) === 0 ) {
require_once 'LocalSettings_priv1.php';
} elseif ( strpos( $callingurl, '/priv2' ) === 0 ) {
require_once 'LocalSettings_priv2.php';
} elseif ( strpos( $callingurl, '/' ) === 0 ) {
require_once 'LocalSettings_public.php';
} else {
header( 'HTTP/1.1 404 Not Found' );
echo "This wiki (\"" . htmlspecialchars( $callingurl ) . "\") is not available. Check configuration.";
exit( 0 );
}
为了进行测试,我尝试将require_once 'localsettings_public.php'
行中的文件名更改为每个子wiki的LocalSettings.php
文件;当我打开wiki.mysite.com
时,相关的子维基会正确显示。但是,具有子目录路径的URL将继续返回404。
知道我的设置有什么问题吗?