Today IIS team has released the URL Rewrite Module 2.0 for IIS 7 – Beta. This is an incremental release that includes all the features from version 1.1, and adds support for outbound response rewriting. More specifically, it can be used to:
- Replace the URLs generated by a web application in the response HTML with a more user friendly and search engine friendly equivalent
- Modify the links in the HTML markup generated by a web application behind a reverse proxy.
- Fix up the content of any HTTP response by using regular expression pattern matching
Install the URL Rewrite Module 2.0 Beta
or, download:
Note:
- URL Rewrite v1.0 and v2.0 cannot be installed side-by-side.
- URL Rewrite v1.1 and v2.0 cannot be installed side-by-side.
- If URL Rewrite v1.0 or v1.0 is already installed, uninstall it before proceeding with installing URL Rewrite Module v2.0 Beta.
New Features
URL Rewrite Module 2.0 includes the following key features:
- Rules-based response rewriting engine. Outbound rules are used to express the logic of what to compare parts of the response with and what to do if comparison was successful. Web server and site administrators can use outbound rules to define complex response rewriting logic.
- Rewriting within the content of specific HTML tags. Instead of scanning the entire response for a particular match, the rule can be configured to look only inside of certain HTML tags, such as <a>, <img>, etc. That way the pattern is greatly simplified and the process of applying the rule to the content is much faster comparing to applying the pattern to the entire response.
- Pre-conditions for outbound rules. Applying rewrite rules on every response is an expensive operation and is not necessary in majority of the cases. Pre-conditions are used to check the response metadata to determine if outbound rules evaluation should be applied.
- Setting of server variables and HTTP headers. Various IIS server variables and HTTP request headers can be set by using rewrite rules.
- Tracking capture groups across rule conditions. The conditions back-referencing logic in URL Rewrite 1.1 worked only against the last matched conditions. In v2 it is possible to configure back-referencing logic to work against all matched conditions.
- Logging of rewritten URLs. The module can be configured to log the rewritten URL in IIS W3C logs as opposed to logging an originally requested URL.
More information
Use the following links to get more information about URL Rewrite Module 2.0 Beta:
Also, be sure to visit the URL Rewrite Forum on IIS.NET if you have run into any problems when using the module or have questions or suggestions.
I have a problem on my IIS7 with this release, it is the first time I am trying this, and no luck so far, just would not work. Running on server 2008, latest patches etc.
This is my web.config entry:
The current URL in the browser looks like this -> http://localhost/myapp/genericpage.aspx?pid=sample
But want it to look like this -> http://localhost/myapp/sample/genericpage.aspx
What am I doing wrong? Any help would be much appreciated.
Can you please XML encode the rewrite rules and then re-post them in the comment?
This looks like a really good feature -do you have any data on the performance impact of parsing and modifying output? I appreciate that its server specific but any info would be of interest.
Cheers,
Steve
Steve: there will be a performance impact caused by parsing and modifying an output. It depends on how many matches are found in the output and what kind of request it is. For example if it is a static file then the performance impact is more noticeable because statis files are super fast on IIS. If it is a database bound dynamic application then the outbound rewriting is usulally not the performance bottleneck.
I do not have any numbers to share – I recommend to just set up the rules and do a load test on your application to see how much it affects it.
Hi I am trying to use rewrite module 2.0 to rewrite a simple ststic url but i cant get this to work
the page i am trying to rewrite looks something like this
http://www.mysite.com/about/pages/default.aspx
i want to rewrite it as
http;//www.mysite.com/about-us/
i have been using rewrite module 1 and everything worked perfectly but since i installed version 2.o i cant even get simple static urls to rewrite / redirect correctly. I would appreciate any suggestions on how to get this working.