2017-05-05 55 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>