BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Rewrite Outbound URLs with IIS 7 and URL Rewrite Module 2.0

| by Jonathan Allen on Jul 20, 2009. Estimated reading time: 1 minute |

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 Stage
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.

Tell us what you think

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

Email me replies to any of my messages in this thread

So, the big news is... by Mike Mormando

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

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

Email me replies to any of my messages in this thread

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

Email me replies to any of my messages in this thread

2 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and dont miss out on content that matters to you

BT