Customise MediaWiki Into Your Own Collaborative Website

Customise MediaWiki Into Your Own Collaborative Website

The free MediaWiki software is best known for powering Wikipedia, but you don’t have to be writing an encyclopaedia to put it to good use. Extend, skin and customise MediaWiki to create any kind of easy-to-update, collaborative web site.

When and Why MediaWiki?

MediaWiki is arguably the most advanced, install-it-yourself, free wiki package available. A wiki is an editable web site; you can change each page’s content without having to log into a content management system like WordPress or access the server via FTP or other means — you just hit the edit button. While MediaWiki is built for public web sites that anyone can update, like Wikipedia, you can customise it to limit access to certain users. Like WordPress and Firefox, MediaWiki is extendable via plugins that add functionality. MediaWiki is also skinnable, which means your wiki can sport a custom theme so it doesn’t look just like Wikipedia.


Recently, Adam and I used MediaWiki to write, publish and expand a book-in-progress using MediaWiki. Check it out to get a feel for what a non-Wikipedia website using MediaWiki can look like.

MediaWiki Installation and Basic Usage

To use MediaWiki, you’ll need a web server with PHP and MySQL available and some experience installing web applications. If you’ve installed WordPress before, you’ll have no problem installing MediaWiki. To do some of the customisations below, you’ll have to be comfortable adding files to your installation, doing some light PHP file editing, and in the case of skins, know how to tweak HTML and CSS to get your skin to look how you want.

Here are MediaWiki’s latest installation instructions. If you don’t want to deal with the hassle of setting up a web server with PHP and MySQL and MediaWiki, check out the quick-setup BitNami installer for MediaWiki.

Once MediaWiki’s installed, you can start adding and editing pages to your wiki. Wiki pages aren’t made of HTML like regular pages, they’re made of special wiki markup. Here’s a rundown of the most common bits of wiki markup you’ll need to know. To see wiki markup in action, hit the play button to watch a five-minute screencast demonstrating how to edit and create pages (“chapters”) of a novel in MediaWiki.

MediaWiki Skins

Out of the box, MediaWiki comes with the look and feel you’re so used to from Wikipedia; this MediaWiki skin is called MonoBook, and it’s popular and immediately recognisable. However, if you log into your MediaWiki installation and click on preferences, and then the Skins tab, you can dress up your wiki in various other looks. With a little elbow grease, you can also create your own custom skin and assign it as the default to the wiki.

Newbie MediaWiki skin developers would do well to start with a copy of the MonoBook skin files and modifying them. WikiHow (another MediaWiki-based site!) offers a simple tutorial on how to do that: How to Create a MediaWiki Skin Based on the MonoBook Skin. You can always preview a skin in your user Preferences->Skins area as you develop to make sure things look how you want. The (X)HTML markup for your skin will be located in its .php file and the CSS files will be located in the skin’s folder. Be sure to save any skin-specific images in the skin’s folder as well.

Once your skin development is complete, you want to set it as the default for everyone who looks at your wiki, whether or not they’re logged in. To do so, in /path-to-your-wiki/LocalSettings.php, set the $wgDefaultSkin variable to to the name of your custom skin and refresh your wiki.

MediaWiki Extensions

MediaWiki extensions

Three MediaWiki extensions you may find useful include:

These three extensions are just the beginning. See MediaWiki’s list of extensions by category for more.

To install an extension, download its zip file and extract it to the /path-to-your-wiki/extensions/ directory. Then, in your LocalSettings.php file, add a line that includes the extension file. For example, to activate the Cite extension, you’d use the line require_once(“$IP/extensions/Cite/Cite.php”);. (Each extension’s homepage will provide the line of code you’ll need to install it, and how to use the extension once it is installed.)

MediaWiki User Permissions


For example, MediaWiki comes with a mechanism to register users, so people can create an account at your wiki and log in. This comes in handy if you want to restrict edit access to only people who are logged into your wiki. Likewise, you can “protect” pages on your wiki and grant only certain users “editprotected” page access.

To set your MediaWiki user permissions, you have to edit the LocalSettings.php file. For example, to disable the ability for anyone who visits your wiki to edit its pages, create pages, or add to talk pages, use this code:

$wgGroupPermissions[‘*’] [‘edit’]= false;
$wgGroupPermissions[‘*’] [‘createtalk’]= false;
$wgGroupPermissions[‘*’] [‘createpage’]= false;

Above, the * represents all users.

A default group called “user” refers to visitors who have created an account and logged into your wiki. To give them edit privileges, add the following to your LocalSettings.php file:

$wgGroupPermissions[‘user’] [‘edit’]= true;

You can even restrict edit access only to users who have created an account AND verified their email address with this code in LocalSettings.php:

# Disable for everyone.
$wgGroupPermissions[‘*’] [‘edit’]= false;
# Disable for users, too: by default ‘user’ is allowed to edit, even if ‘*’ is not.
$wgGroupPermissions[‘user’] [‘edit’]= false;
# Make it so users with confirmed e-mail addresses are in the group.
$wgAutopromote[’emailconfirmed’]= APCOND_EMAILCONFIRMED;
# Hide group from user list.
$wgImplicitGroups[]= ’emailconfirmed’;
# Finally, set it to true for the desired group.
$wgGroupPermissions[’emailconfirmed’] [‘edit’]= true;

MediaWiki’s user rights scheme is complex but deeply customisable. See the Manual’s User Rights page for a full list of rights, default groups and how to create your own groups with custom access privileges.

More MediaWiki customisation Fun

This overview of skins, extensions and user permissions is just a broad look at what’s possible in the world of MediaWiki customisation. Here are links to a few more common tweaks you might make to your wiki:

  • Set your logo image: If you’re using MonoBook or another skin that uses a wiki logo, set it to your custom image.
  • Prettify your wiki URLs: By default, MediaWiki’s page URLs look like /index.php?title=Your_Page, but an .htaccess file tweak can make them look like Wikipedia’s clean /wiki/Your_Page links.
  • Set a custom Main Page: If “Main Page” isn’t the first two words you want your wiki’s visitors to see, you can move the Main Page to a custom page you create and name.
  • Use MediaWiki templates for reusable modules: If you use repetitive page elements, like an image with a caption formatted a certain way, set up a MediaWiki template for easy reuse.
  • Make your wiki read-only with $wgReadOnly: To disable editing on all pages across the board on your wiki, set the $wgReadOnly variable to an explanatory string in your LocalSettings.php file. For example, the line $wgReadOnly = “Wiki locked for maintenance”; will disable editing of all pages and display that message to anyone who tries to edit a page.

What are your favourite MediaWiki customisations, extensions or skins? Share ’em in the comments.

Gina Trapani, Lifehacker’s founding editor, is very excited to finally co-author a book for real using MediaWiki. Her Smarterware feature appears every week on Lifehacker.


Log in to comment on this story!