Mark S. Rasmussen
Jun 21

In this post I’ll walk you through how to setup IIS Application Request Routing so that any requests for a /wiki/ subdirectory are routed onto a separate server, while all other requests are handled by the server itself.

Let’s imagine a fictional scenario where I want to add a wiki to my website. Thus, all requests to* are mapped to a dedicated LAMP based server that runs some kind of wiki software. All other requests should be served by the normal webserver.

The first task is to setup a new server farm, called Wiki in my case. Add the server to the list of servers, using its hostname, MyWikiServer in this case. If you setup (temporarily, for testing) so it maps to the wiki server, requesting should return back the expected result from the wiki server, if requested from the normal webserver.

    <webfarm enabled="true" name="Wiki">
        <server enabled="true" address="MyWikiServer">
            <add name="Microsoft.Web.Arr.HostNameRoundRobin">
            <add name="Microsoft.Web.Arr.HostNameMemory">

Next, setup a URL Rewrite rule at the global level like the following:

The rule matches all requests for the /wiki/ directory, whether there’s a trailing slash or further subdirectories. It ensures not to match a request like /wikipedia/. The request is routed onto the Wiki webfarm which sends the request onto the MyWikiServer server. Note that there’s a condition ensuring this rule will only match requests for the domain so other websites aren’t affected. There are no changes to the actual website setup.

Correction: As noted by Rob Hudson, the regular expression should actually be:


Mark S. Rasmussen
I'm the CTO at iPaper where I cuddle with databases, mold code and maintain the overall technical & team responsibility. I'm an avid speaker at user groups & conferences. I love life, motorcycles, photography and all things technical. Say hi on Twitter, write me an email or look me up on LinkedIn.