How to install MediaWiki on a subdomain

Here is how to set up MediaWiki on a subdomain and use pretty/short URLs. This was tested on July 1, 2010 with MediaWiki 1.15.4, PHP 5.2.8, MySQL 5.0.90 and Apache 2.2.11.

This assumes you are in a shared hosting situation, and do not have root access and cannot edit the Apache configuration files directly.

Your setup

Suppose you have a site, www.ilikefish.com. Its DocumentRoot is /var/www/ilikefish.com. You then create a subdomain, wiki.ilikefish.com, with a DocumentRoot of /var/www/ilikefish.com/wiki.

Configuring Apache

  1. In /var/www/ilikefish.com/.htaccess, set up a redirect

    RedirectMatch /wiki/(.*) http://wiki.ilikefish.com/$1

  2. In /var/www/ilikefish.com/wiki/.htaccess, set up rewrite rules:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

Configuring MediaWiki

  1. In LocalSettings.php, set the following variables:

    $wgScriptPath = "";
    $wgArticlePath = "/$1";
    $wgUsePathInfo = true;
    $wgLogo = "/my_fish_logo.png";
    $wgScriptExtension = ".php";

3 Responses to How to install MediaWiki on a subdomain

  1. Mith says:

    Hi Paul,

    What would one do if one wanted a multi-lingual website with, e.g. en.ilikefish.com/wiki, fr.ilikefish.com/wiki etc. etc.?

    Thanks

    Mith

  2. Viola says:

    How to make multilingual with subdomains with mediawiki

  3. Adriana says:

    I have a wiki on domain, Now I want to install another wiki’s on subdomain how to redirect file? Does anyone know.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>