Getting Started With URL Rewrite

As a server administrator, primarily focused on IIS, I like spending time in the IIS forums.  I frequently see questions related to URL Rewrite rules so I wanted to make a guide for the plethora of information that is available on the Internet.

The most obvious place to start is on www.iis.net itself.  Section 5 of the site is dedicated to the URL rewrite module containing dozens of individual articles devoted to URL Rewrite.  You can start here and find all kinds of helpful articles.

If you want to know all the ins and outs of URL Rewrite, Scott Forsyth’s Blog has a large amount of posts dedicated to the topic going deep into detail on nearly every aspect of URL Rewrite.  I often turn to his posts when I’m working on a complex URL Rewrite and get stuck.

image

Many of you don’t need to get started with rewriting in general, you are familiar with it from ISAPI Rewrite or Apache’s mod_rewrite.  URL Rewrite has a convenient tool that can be used to convert rules.  Select Import Rules from the right action pane under the URL Rewrite feature in IIS Manager.

image

That will bring you to the Import mod-rewrite Rules feature.  In the Rewrite rules: box, paste in the rewrite rules that you have and they will be converted to URL Rewrite rules in the Converted Rules box.  In this case, I took an ISAPI Rewrite rule to redirect www.domain1.com or domain1.com to www.domain2.com

image

To have this rule added to your site’s URL Rewrite rules, simple click Apply in the right actions pane.

In this post, I provided two resources that have dozens of examples and resources available to you so that you can get the most from URL Rewrite.  I also showed how simple it is to convert existing rules over to the URL Rewrite format.  I hope you find this helpful in your future rewriting ventures.

No Comments