Manual:Short URL/IIS6

Mitchell Gabor

IIS6 and ShortURL support
Internet Information Services6 requires an ISAPI URL Rewrite filter to work. Several commercial filters are available. An open source ISAPI filter is available for free from http://www.codeplex.com/IIRF called Ionic's Isapi Rewrite Filter (IIRF). As of August 2007, IIRF version 1.2.12c is known to work with MediaWiki 10.1 using IIS6 under Windows Server 2003 SP1. It is likely that other IIS implementations are supported, as IIRF is also IIS 5.0 (Windows 2000) and IIS 5.1 (Windows XP) compatible.
 * Installation instructions are available from IIRF's website in the download package.
 * IIRF has a comprehensive forum providing install support.
 * To successfully configure IIRF, an INI file must be customized for MediaWiki. See below for details.

Sample INI file code for MediaWiki at wiki.domain.com/wiki/: (IsapiRewrite4.ini, stored in same path as IsapiRewrite4.dll) RewriteLog c:\temp\iirfLog.out RewriteLogLevel 3 MaxMatchCount 1 RewriteEngine On

RewriteCond %{HTTP_HOST} ^wiki.domain.com
 * 1) Change to suit your domain

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
 * 1) Checks for local file existance so that .css, .js and other MediaWiki files aren't processed

RewriteRule ^/wiki/(.*)$ /wiki/index.php?title=$1 [I,L] RewriteRule ^/wiki/Special:Search(.*)$ /wiki/index.php$1 [I,L] IterationLimit 4

(Alternate IsapiRewrite4.ini) RewriteLog c:\temp\iirfLog.out RewriteLogLevel 3 MaxMatchCount 10 RewriteEngine On

RewriteCond %{HTTP_HOST} ^wiki.example.com
 * 1) Change to suit your domain

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
 * 1) Checks for local file existance so that .css, .js and other MediaWiki files aren't processed

RewriteRule ^/wiki/Special:Search(.*)$ /w/index.php$1 [L] RewriteRule ^/wiki/(.*)$ /w/index.php?title=$1 [I,L] RewriteRule ^/wiki(//+)?$ /w/$1 [L] RewriteRule ^/*$ /w/ [L]

(Alternate 2 IsapiRewrite4.ini) RewriteLog c:\temp\iirfLog.out RewriteLogLevel 3 MaxMatchCount 1 RewriteEngine On

RewriteCond %{HTTP_HOST} ^wiki.yourdomain.com
 * 1) Change to suit your domain

RewriteRule ^/(Special:Search)\?(.*)$ /index.php?title=$1&$2 [I,L]
 * 1) Special:Search needs its own rule, the generic rule follows

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/(.*)$ /index.php?title=$1 [I,L]
 * 1) Checks for local file existance so that .css, .js and other MediaWiki files aren't processed

IterationLimit 4

(Also edit your LocalSettings.php. Add this after $wgSitename)

Alternative
To Windows User who MUST use IIS servers,

IIS 5.x/IIS 6.0
IIS 5.x and 6.0 do not possess built-in rewrite yet. This means MediaWiki/IIS end-users shall continue to see ugly URLs (and not Apache's Short URL.)  An (extremely short) list of IIS ISAPIs that supports or adds rewrite capability.


 * Helicon Tech ISAPI / rewrite / ($)

ISAPI Rewrite 3 now looks to support Apache mod_rewrite syntax inside a .htaccess file. This means that many (if not all) of the guides here for Apache servers using mod_rewrite can work on IIS 5.x and 6.0 without having to modify the code at all if you have ISAPI rewrite 3 installed on your Windows server.

IIS 7.0
Just recently, IIS 7.0 now support rewrite capabilities. (Note: If you accomplish this installation, please edit this Short URL for IIS7 page.)