Forum Moderators: open
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.
More info:
URL Rewrite Module 2.0 usage walkthroughs [learn.iis.net]
URL Rewrite Module 2.0 configuration reference [learn.iis.net]
This looks great, I was already very happy with version 1.1, but the ability to clean up URLs before they are sent to the browser will be great for some of the older sites I manage.
sadly, creating two website profiles and using a permanent redirect to www site com$S$Q was much easier than setting up a redirect in IIS 7.0.
i know it may be easier to just make changes to the web.config file, but i have to make simple instructions for a coworker to work on setting up the redirects and XML code is a bit beyond her.
Here is some code for a non-www to www redirect:
<rule name="Redirect to www" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^example.com$" />
</conditions>
<action type="Redirect" url="http://www.example.com/{R:0}" redirectType="Permanent" />
</rule>
I am currently writing up an intro to the new module with a collection of useful rules. Hopefully I will have this ready soon for posting.