BT

InfoQ Homepage News Rewrite Outbound URLs with IIS 7 and URL Rewrite Module 2.0

Rewrite Outbound URLs with IIS 7 and URL Rewrite Module 2.0

Bookmarks

The URL Rewrite Module was originally introduced to map incoming, user-friendly URLs to pages written with ASP.NET or PHP. With version 2, the other side is addressed. URLs automatically generated by applications can rewritten before they hit the user’s browser.

Outbound rules consist of several parts:

  • Pre-conditions are used to eliminate responses that should never be rewritten. This would generally be binary data like PDFs, images, and videos as well as JavaScript frameworks.
  • Tag Filters allow you to look at only specific types of tags like anchors (a) or images (img).
  • Patterns are based on either wildcard matches or full regular expressions. The regular expression engine is supposed to be Perl compatible and ECMAScript standard compliant. However, without knowing the specific engine used, there is bound to be unforeseen quirks. Wild cards, while easier to write, can only be used in conjunction with tag filters.
  • Conditional checks based on the pattern matches can further restrict the rule.
  • The actual rewriting, referred to as the “rule action”, can be based on a combination of pattern matches and the server variables.

Speaking of which, both server variables and request headers can also be rewritten using this module. Pattern matching and conditional checks can be applied to rules that alter these.

In order to assist in debugging, logging of rewritten URLs is now possible by editing a registry setting.

You can find out more in the URL Rewrite Module 2.0 Configuration Reference.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • So, the big news is...

    by Mike Mormando /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    That now IIS has once again taken a step to get to be ALMOST as good as Apache server has been for at least since 1997. Great progress for a truly great company. On the "down" side, it apparently still converts everything to lower case.
    Sigh

  • Re: So, the big news is...

    by Jonathan Allen /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Not quite. Apache didn’t get a decent modular system until 2002. Considering that IIS got it’s in 2008, it is only 6 years behind the curve.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.