Last week we shipped the first preview of URL Rewrite Module for IIS 7.0. If you are not familiar with URL Rewriting engines, please check out the walkthroughs:

 http://learn.iis.net/page.aspx/460/using-url-rewrite-module/.

If you are you familiar with mod_rewrite, I’m pleased to let you know that we have a mod_rewrite rule importer feature to help you to leverage your rule-crafting knowledge:

 http://learn.iis.net/page.aspx/470/importing-apache-modrewrite-rules/

URL Rewrite Module ships two matching engines, one for Regular Expressions (Perl 5 compatible/ECMAScript) and a simple one for wildcard matching. You can choose the engine you feel more comfortable with, I just want to give you some facts (some of them are silly but they are just a reminder):

1.       Regex matching is more powerful, but expensive in terms of execution time.

2.       Wildcard matching is cheaper than Regex and easy to understand.

3.       Both engines are case-insensitive by default.

4.       Case-sensitive matching has much better performance than case-insensitive.

5.       Wildcard matching assumes “exact match”. For an expression like “blog”, it would match “blog” and only “blog”.

6.       Regex matching assumes “partial match”. In this case, “blog” will match “blogger”, “demo/blog”. If you want an exact match you need to change the match expression to “^blog$”.

7.       In Regex, “.” is reserved, it means “any character”, so “default.aspx$” will match “defaultXaspx” too. Escape it to “default\.aspx$’. Wildcards doesn’t have this behavior, the only reserved character is ‘*’.

8.       To create a capture in Regex, use parenthesis.

9.       Each ‘*’ in a wildcard expression creates a capture. For example, an expression like “*.*” would match “logo.jpg” and it will create 2 captures, “logo” and “jpg” (without the dot).

10.   You can reference a capture by index. The index is 1-based, so in the previous example 1 means “logo” and 2 means “jpg”.

11.   The index 0 means “the entire input”. In the previous example 0 means “logo.jpg”.

12.   The syntax for back-reference a capture is {type:index} where type can be R for “Rule Back References” and “ C for “Condition Back References”. The index must be and integer equals or greater than zero.

Please give all the feedback you want, this is a technical preview so your feedback can definitely make a difference for the next release.

Install it from:

Microsoft URL Rewrite Module for IIS 7.0 CTP1 (x86)

Microsoft URL Rewrite Module for IIS 7.0 CTP1 (x64)

URL Rewrite Forum:

http://forums.iis.net/1152.aspx