MediaWiki - Mirror domain

0

I’ve manually installed Mediawiki at example.com/wiki with two separate databases (one in english and one in portuguese) and created two subdomains at pt.example.com and en.example.com mirroring the main domain. Then I’ve edited LocalSettings to point to each database depending on which subdomain you’re accessing. Except for those settings I didn’t touch anything else, not one other setting and not even the wiki itself yet, and apparently everything works fine.

The only problem is when I try accessing the “Random Page” link, it completely removes any subdomain and just directs to the main site (without “en.” or “pt.” at the beginning). Normally I would just remove that feature, but some people like using that and I’m also afraid that it may occur on other pages as well, so I rather just fixing it.

Versions are as follows: MediaWiki: 1.31.1 PHP: 7.2.11 (cgi-fcgi) MySQL: 5.6.34-log ICU: 52.1

Thanks in advance!

Paulo Renato Pereira

Posted 2018-12-26T10:26:41.390

Reputation: 1

Answers

0

I just noticed I didn't customize the server for each localization, so all I had to do was set $wgServer for each LocalSettings.php file to their respective subdomains, like:

LocalSettings_pt.php

$wgServer = "http://pt.example.com";

LocalSettings_en.php

$wgServer = "http://en.example.com";

Paulo Renato Pereira

Posted 2018-12-26T10:26:41.390

Reputation: 1

Or $wgServer = "//pt.example.com"; $wgCanonicalServer = "http://pt.example.com"; if you also support HTTPS (no excuse not to these days when LetsEncrypt is just one script execution away :) – Tgr – 2018-12-27T21:19:57.240