2017-05-05 41 views
0

我有一个在其根目录下有WordPress安装的子域(例如https://sub.domain.com)。这会打开WordPress的首页。如何在同一子域上启用WordPress安装和Mediawiki安装?

然后我安装在一个名为w目录Mediawiki的安装和使用方法SHORTURL specified here in this Mediawiki documentation更名并添加了必要的.htaccess调整,使MediaWiki的安装使用此URL结构:https://sub.domain.com/wiki

然后,我在另一个名为typ的文件夹中添加了另一个Mediawiki安装,并遵循上述相同的步骤。

我想为不同的目的安装2个Mediawiki。他们不相互关联。

但是,在Mediawiki安装之后,WordPress接手了,当我尝试访问/wiki网址时,我从WordPress获得404 not found

这里是我的.htaccess代码:

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 

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

RewriteRule ^/?typing(/.*)?$ %{DOCUMENT_ROOT}/typ/index.php [L] 
RewriteRule ^/?$ %{DOCUMENT_ROOT}/typ/index.php [L] 

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d 
RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B] 

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d 
RewriteRule ^/?w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B] 



</IfModule> 
# END WordPress 

# php -- BEGIN cPanel-generated handler, do not edit 
# NOTE this account's php is controlled via FPM and the vhost, this is a place holder. 
# Do not edit. This next line is to support the cPanel php wrapper (php_cli). 
# AddType application/x-httpd-ea-php70 .php .phtml 
# php -- END cPanel-generated handler, do not edit 

获得MediaWiki的设备显示的唯一方法是注释掉WordPress的线条,就像这样:

#RewriteBase/
#RewriteRule ^index\.php$ - [L] 
#RewriteCond %{REQUEST_FILENAME} !-f 
#RewriteCond %{REQUEST_FILENAME} !-d 
#RewriteRule . /index.php [L] 

我的问题是:有没有办法让所有的装置同时工作?所以https://sub.domain.com打开WordPress安装,https://sub.domain.com/wikihttps://sub.domain.com/typing打开MEdiawiki安装?

回答

0

我发现的唯一解决方案是将Mediawiki行向上移动.htaccess文件,删除重复项。

这里是工作的最终代码:

<IfModule mod_rewrite.c> 
RewriteEngine On 

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

RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 

RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B] 
RewriteRule ^/?w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B] 

RewriteRule ^/?typ/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/typ/thumb.php?f=$1&width=$2 [L,QSA,B] 
RewriteRule ^/?typ/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/typ/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B] 


</IfModule>