IIS Mod-Rewrite examples
Overview Documentation Download Purchase FAQ  
IIS Mod-Rewrite - URL rewrite tool for IIS

Example: Load balancing

Scenario:

In this example, we have a webserver (www.domain.com) that accepts all incoming clients. Its only task is to randomly redirect all incoming requests to five webservers under the same domain (www1,..., www5). This way the network load is evenly distributed to the five webservers.

Configuration:

Map Text:
#Webservers.txt
server www1|www2|www3|www4|www5


Configuration text:
#Turn IIS Mod-Rewrite engine on
RewriteEngine On

#Load map with random webserver names
RewriteMap ServerMap rnd:x:\path\Webservers.txt

#Check if the client requested "domain.com" or "www.domain.com"...
RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]

#...and if so, redirect the request randomly to one of the web servers
RewriteRule ^(.*)$ http://${ServerMap:server}.domain.com$1 [R,L]
 
Download and try
IIS Mod-Rewrite
NOW!


IIS rewrite

Download IIS Mod-Rewrite

Purchase IIS Mod-Rewrite