Enable rewrite in Mediawiki

To those who want to enable rewrite in Mediawiki, please take a look at the following instructions:

  1. Move your Wiki to a sub directory of your site, for instance /w
  2. Create .htaccess in root directory, that is / and add the following lines to it:
  3. RewriteEngine on
    RewriteRule ^wiki/?(.*)$ /w/index.php?title=$1 [L,QSA]

  4. Open your LocalSettings.php and add the following lines to it:
  5. $wgScriptPath = “/w”;
    $wgScript = “/wiki”;
    $wgArticlePath = “$wgScript/$1″;

  6. Done.

Before you try this, please make sure you have enabled the rewrite feature of your Apache. and what the most important is: when you enabled rewrite in httpd.conf, you must stop it and start it. please note, if you just try ‘restart’, it won’t work. i was stuck here for a loooog time. :(