How to enable a WordPress installation and a Mediawiki installation on the same subdomain?

I have a subdomain that has a WordPress installation on its root (e.g. https://sub.domain.com). This opens the WordPress frontpage.

Then I installed a Mediawiki installation in a directory called w, and renamed it using the ShortURL method specified here in this Mediawiki documentation and added the necessary .htaccess adjustments to make the Mediawiki installation uses this url structure: https://sub.domain.com/wiki.

Then I added another Mediawiki installation in another folder called typ and followed the same steps detailed above.

I wanted to have 2 Mediawiki installations for different purposes. They are not linked to each other.

However, after the Mediawiki installations, the WordPress took over, and when I try to access the /wiki urls, I get a 404 not found from the WordPress.

Here is my .htaccess code:

# 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

The only way to get the Mediawiki installations to show is to comment out the WordPress lines, like this:

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

My question is: Is there a way to get all the installations working at the same time? so https://sub.domain.com opens the WordPress installation, and https://sub.domain.com/wiki and https://sub.domain.com/typing open the MEdiawiki installation?

Read more here: How to enable a WordPress installation and a Mediawiki installation on the same subdomain?

Leave a Reply

Your email address will not be published. Required fields are marked *