Manual:Short URL/IIS6

IIS6 and ShortURL support edit

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

# Change to suit your domain
RewriteCond %{HTTP_HOST} ^wiki.domain.com

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

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

# Change to suit your domain
RewriteCond %{HTTP_HOST} ^wiki.example.com

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

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

# Change to suit your domain
RewriteCond %{HTTP_HOST} ^wiki.yourdomain.com

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

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

IterationLimit 4

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

$wgArticlePath = '/wiki/$1';  # Virtual path. This directory MUST be different from the one used in $wgScriptPath
$wgUsePathInfo = false;

// my $wgScriptPath = "/w";

Alternative edit

To Windows User who MUST use IIS servers,

IIS 5.x/IIS 6.0 edit

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 / ($) [1]

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.