url rewrite rule converter

articles:

url rewrite rule converter

A little converter to convert the ISAPI rewrite 2 rules contained in the httpd.ini to IIS7 or IIS7.5 url write rules contained in web.config

This tool is pretty simplistic and doesn't do any sanity checking on the rules you enter.

It will interpret the following flags:

  • L (last rule)
  • I (ignor case)
  • R (temporary redirect)
  • RP (permanent redirect)

You can also include two line rules that have both RewriteCond and RewriteRule, however, the only RewriteCond supported is Host:

Example:

RewriteCond Host: domain\.co\.uk
RewriteRule (.*) http\://www.domain.co.uk$1 [RP]

converts to:

<rule name="Rule0" stopProcessing="false">
     <match url="(.*)" ignoreCase="false" />
     <conditions>
        <add input="{HTTP_HOST}" pattern="domain\.co\.uk" />
     </conditions>
     <action type="Redirect" url="http\://www.domain.co.uk{R:1}" redirectType="Permanent" />
</rule>

Even if it doesn't convert the more advanced rules - it can save you a bit of time if you've got a large number straight forward rules to convert - it's probably saved me half a day so far. Anyway, here is the tool to convert url rewrite rules. If it saves you some time please come back to this page and leave a commment.

Comments

Posted on Thursday, July 23, 2015 10:49:00 AM GMT by Biobiotirm
The URL Rewrite Module in IIS 7 and above provides an import feature that greatly simplifies the process of converting Apache mod_rewrite rules to IIS URL rewrite rules. In this walkthrough, you us.
Posted on Wednesday, April 12, 2017 1:47:00 AM GMT by Diego
Thank you, it was very helpful!

Post a comment

name:
(optional)

email:
(optional)

comment: