Migating MediaWiki to Confluence

May 22, 2014

I wanted to move pages from an old MediaWiki install into Confluence. This can be done with the Universal Wiki Converter (UWC) tool.

Step 1: Download UWC and unzip it on the box containing MediaWiki

Step 2: Edit conf/exporter.mediawiki.properties



to be the mysql logon used by mediawiki.

Also edit the output path to point to a writeable directory:


You can also change the following if required:


Step 3: Run run_uwc.sh on the MediaWiki box

This brings up a console application, so it needs to run under a graphical desktop. Click the export button and it will write a text file for each page in MediaWiki to the output directory.

Step 4: Copy output files and attachments to confluence box

Copy the output text files generated by the export to the Confluence box. Also copy any attachments from the MediaWiki install to the Confluence box - it's enough to simply copy the images directory these are uploaded to. To find this, locate an image in your MediaWiki, find it's filename, then search the box for a file of this name.

# find / -name RGB_stacked_small.jpg

So the directory here is /var/www/html/wiki/images

Step 5: Massage the files to remove XML

I had trouble with XML in the exported MediaWiki pages. I fixed this by encoding < and &lt; and > as &gt; You can do this with the following two commands in the directory with the exported page files.

$ sed -i "s/</\&lt;/g" *.txt
$ sed -i "s/>/\&gt;/g" *.txt

Step 6: Enable Confluence Remote API

You'll need to enable the Confluence API for the UWC to be able to create pages. Click the cog icon, then General Configuration, then Further Configuration. Click Edit and enable the checkbox next to Remote API (XML-RPC & SOAP). Save.

Step 7: Download UWC and unzip it on the box containing Confluence

Step 8: Run run_uwc.sh on the Confluence Box

Point it at the attachments directory, then add the pages you want to migrate. Fill in url of your Confluence deployment along with a valid username, password. You also need to specify the Space Key here - I suggest you use a new empty space to upload into. You can test this connection with Confluence using a button on the second tab.

Step 9: Click the Convert button

Click convert and then watch the output window - you'll see it read the files then upload them to Confluence. I had errors with a handful of files that I then had to convert manually - don't expect everything to be easy!