Mediawiki farm on subdomains


I’m currently running Mediawiki in my standard Apache folder, that is, /var/www/html. I’ve now been tasked to make the Mediawiki multilingual, which I can achieve by creating a wiki farm through setting up technically individual wikis on different subdomains through virtual hosts and then connecting them through Mediawiki extensions.

I’ve tried experimenting with the virtual hosts recently, though I only got it to work to a degree.

So, before crashing stuff, I just wanted to ask you about my concrete problem:

I want to move the current installation of Mediawiki located at /var/www/html/ to /var/www/html/de/ , as well as copy that same installation to /var/www/html/en/ (for later editing, just to not have to reinstall it again).

And, subsequently, I want to point at /var/www/html/de/ and at /var/www/html/en/.

Additionally, should link to

Since I’m currently kind of confused at how to properly achieve this, I’d really appreciate just a quick concrete guide for this specific problem.

Thank you in advance!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


You are on the right path for this. You can use Apache virtual hosts to handle the multiple subdomains. Your folder structure is also attractive, it doesn’t make a common mistake (nesting one install under another). Copying the files from one folder to another should be fine too, something like:

cp -R /var/www/html/de /var/www/html/en

Here’s a guide on Apache virtual hosts:

The next thing you want to take care of is the database. MediaWiki supports MySQL, PostgreSQL, and SQLite. If you run SQLite this is stupid easy, and I’m jealous of how easy it is for you. At that point it’s just done, you need go no further. Kick back and relax. Unfortunately, or fortunately if you dislike SQLite, that probably isn’t how you have it setup.

I’m going to take a shot in the dark and assume you’re running MySQL for it. Look for your LocalSettings.php file and grab your MySQL configuration variables. Here is some information on that:

Here’s an example of what those might look like:

$wgDBtype           = "mysql";
$wgDBserver         = "localhost";
$wgDBname           = "my_wiki";
$wgDBuser           = "root";
$wgDBpassword       = "1234";

For my purpose, I’m going to assume the example above to be accurate. So any time you see me mention those values below, know that you need to replace them with your own. I’m also going to adjust them for the new wiki, and that is going to be these variables, which you will also change as desired:

$wgDBtype           = "mysql";
$wgDBserver         = "localhost";
$wgDBname           = "my_wiki_en";
$wgDBuser           = "wiki_en";
$wgDBpassword       = "1234";

I’m going to copy the database:

mysqldump my_wiki > /root/my_wiki.db

create database my_wiki_en;
grant all on my_wiki_en.* to wiki_en identified by '1234';

mysql my_wiki_en < /root/my_wiki.db

Then I would edit LocalSettings.php on the EN installation to match the ones I mentioned above:

$wgDBtype           = "mysql";
$wgDBserver         = "localhost";
$wgDBname           = "my_wiki_en";
$wgDBuser           = "wiki_en";
$wgDBpassword       = "1234";

Now the EN version of the wiki should be set. It should go without saying, but don’t be like me and use 1234 as a password :)