Search Engine Friendly (SEF) URLs with MediaWiki

MediaWiki is a powerful and very popular wiki-engine which was originally written for a popular free encyclopedia – Wikipedia. In this short article you will see how to configure SE-friendly URLs in MediaWiki and how ISAPI_Rewrite can help you with it.
In this article we suppose you already have IIS and ISAPI_Rewrite 3 installed. To write the article we used ISAPI_Rewrite and MediaWiki 1.13.1.

Getting and Installing MediaWiki

You can download MW from this page: After downloading please install MW according to installation instructions provided by the vendor.

Enabling SE-friendly URLs

Default MediaWiki URLs look like, but you can change them by using two configuration variables in LocalSettings.php:
$wgScript and $wgArticlePath.
In this article we will try to make
simple SEO-friendly urls like

So, please open LocalSettings.php document (it is located in MediaWiki root folder) and append this code:

$wgScript = "";
$wgArticlePath = "$wgScript/$1";

Please note! The $wgScript variable must contain path to your MW folder. For example, if your MW installation is
then you must write $wgScript = "/mediawiki", or if your MW installation is
C:\inetpub\wwwroot\, then you must write $wgScript = "".

Now please create .htaccess file in the installation folder of MediaWiki and put these rules into it:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?title=$1 [NC,L,QSA]

Done! Now you can use MediaWiki with pretty SE-friendly URLs.

This entry was posted in ISAPI_Rewrite and tagged . Bookmark the permalink.

Comments are closed.