IIS URL Rewrite Module

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

The Microsoft URL Rewrite module provides a rule-based rewriting mechanism for modifying request URLs before they are processed by a Web server, and beginning with version 2.0 the URL Rewrite module can modify response URLs before they are returned to a Web client. The URL Rewrite module can use regular expressions or wildcard characters to create rewriting logic, and can make rewriting decisions based on HTTP headers and server variables. You can also use rewrite rules to perform redirects, send custom responses, or abort requests. You can use the URL Rewrite module to rewrite simple search engine friendly URLs to a more complex internal representation, to block access to specified content on a Web site, and for many other tasks.


The Microsoft URL Rewrite module for IIS 7 provides a flexible rules-based rewrite engine that can be used to perform a broad spectrum of URL manipulation tasks, including, but not limited to, the following.

  • Enable user friendly and search engine friendly URLs for dynamic Web applications.

  • Rewrite URLs based on HTTP headers and server variables.

  • Perform more sophisticated Web site content handling.

  • Control access to Web site content.


The Microsoft URL Rewrite Module includes the following key features:

  • Rules-based URL rewriting engine. Rewrite rules are used to express the logic of what to compare or match the request URL with and what to do if the comparison is successful. Web server and Web site administrators can use sets of rewrite rules to define complex URL rewriting logic.

  • Regular expression pattern matching. Rewrite rules can use regular expression syntax that is compatible with the ECMA-262 standard for pattern matching.

  • Wildcard pattern matching. Rewrite rules can also use wildcard character syntax for pattern matching.

  • Global and distributed rewrite rules. Global rules are used to define server-wide URL rewriting logic. These rules are defined in the ApplicationHost.config file and cannot be overridden or disabled at lower configuration levels. Distributed rules are used to define the URL rewriting logic specific to a particular configuration scope. This type of rule can be defined at any configuration level by using a Web.config configuration file.

  • Access to server variables and HTTP headers. Server variables and HTTP headers provide additional information about the current HTTP request. Server variables can form part of the rewriting logic, or can be used in composing the rewritten URL.

  • Various rule actions. Instead of rewriting a URL, a rule may perform other actions, such as issue an HTTP redirect, abort a request, or send a custom status code to an HTTP client.

  • Rewrite maps. A rewrite map is an arbitrary collection of name-value pairs that can be used within rewrite rules to generate substitution URLs. Rewrite maps are especially useful when you have a large set of rewrite rules, all of which use static strings without any pattern matching. In these cases, instead of defining a large set of simple rewrite rules, you can put all the URL mappings into the rewrite map as keys and values, and then have one rewrite rule which references the rewrite map. The rewrite map looks up the substitution URL based on the input URL.

  • User interface for managing rewrite rules. The URL Rewrite Module feature in IIS Manager makes it easy to add, remove, and edit rewrite rules.

  • Tool for importing mod_rewrite rules. The IIS Manager URL Rewrite module includes an easy-to-use tool for converting Apache mod_rewrite rules into IIS rule format.

The following features are new in URL Rewrite version 2.0:

  • Outbound rewriting. Starting in version 2.0, the URL Rewrite module enables rewriting HTTP responses.

  • Rewriting request and response headers. Also new to version 2.0 is the ability to rewrite the values of HTTP request and response headers.

  • Rewriting server variables. Another new version 2.0 feature is the ability to rewrite the values of server variables.


To use the IIS URL Rewrite module, you must have Windows Server® 2008 with the Web Server Role (IIS 7) installed.

See Also


URL Rewrite Module Page

Other Resources

URL Rewrite Module - Video Walkthrough
URL Rewrite Module Configuration Reference
URL Rewrite Module 2.0 Configuration Reference