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, Its DocumentRoot is /var/www/ You then create a subdomain,, with a DocumentRoot of /var/www/

Configuring Apache

  1. In /var/www/, set up a redirect

    RedirectMatch /wiki/(.*)$1

  2. In /var/www/, 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";

5 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., etc. etc.?



  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.

  4. Reza Gozashti says:

    I created a domain and installed a mediawiki 1.20.6 on my server. I want to create some new pages but I can’t!
    I can see the red link but as I click on the link I get this error:

    Server error
    The website encountered an error while retrieving It may be down for maintenance or configured incorrectly.
    Here are some suggestions:
    Reload this webpage later.
    HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
    would you please help me in this case?

    Thank you

  5. 500 errors are pretty generic. Check your Apache error.log for details.

Leave a Reply

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