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";

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. 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.

  4. Reza Gozashti says:

    Hi,
    I created a domain wiki.example.com 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 http://wiki.sarveno.com/index.php?title=Marketing_Automation&action=edit&redlink=1. 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
    Reza

  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 *