Example #2

The URL Rewrite Module also supports regular expressions. You can match characters in the incoming URL and then use {R:#} ({R:1}, {R:2}, etc.) to reference them in the resulting URL. In this example, we want to match article/id/title and have it processed by article.aspx as a standard GET request:

Example #3

The URL Rewrite Module also provides a method to create a catch-all rewrite rule. This is similar to how applications like Wordpress use Apache's mod_rewrite to create pretty permalinks or friendly URLs by having a single page load content based on the incoming URL. In this example we use the URL Rewrite Module and a simple regular expression to catch anything that isn't a file or directory and send it to default.aspx:

References

Third-party Solutions

Prior to the URL Rewrite Module, web developers had to create this functionality via application code or by generating their own assemblies to implement this feature. Fortunately for application developers, many parties realized this was such a necessary feature; so rather than have every developer reinvent the wheel, these parties created modules that could be deployed to add this functionality with very little effort on the part of the web developer. Some of these third-party modules are:

Example #1

In this example, we match info and display the contents of info.aspx:

<rewriter>
<rewrite url="~/info" to="~/info.aspx" />
</rewriter>

Example #2

UrlRewriter.NET also supports regular expressions. You can match characters in the incoming URL and then use $# ($1, $2, etc.) to reference them in the resulting URL. In this example, we want to match products/id and have it processed by products.aspx as a standard GET request: