
Any other formats of rewrite rules (for example, ISAPI_Rewrite, Ionic ISAPI Rewrite, IISRewrite, and others) are not recognized or will be converted incorrectly.Mod_rewrite must be enabled before being used on an Apache server. Note that only rules that follow Apache mod_rewrite syntax can be converted. Then, after converting to IIS URL rewrite rules, review and test the result of the conversion to make sure that the corresponding IIS rewrite rule set provides the same URL rewriting logic. It is highly recommended that you study a mod_rewrite rule set until you understand its functionality before you begin the conversion process. However, not all mod_rewrite rules can be converted because of architectural differences between Apache and IIS. IMPORTANT - The URL Rewrite Module tries to convert Apache mod_rewrite rules to functionally equivalent IIS URL rewrite rules. A Bing search will reveal other examples of Apache mod_rewrite rules.

On the right, in the Actions pane, click Import Rules.Ĭopy the example mod_rewrite rules above and paste them into the Rewrite rules text box. On the right, in Features View, click URL Rewrite.

On the left, in the Connections pane, select Default Web Site.

To convert these rules to IIS URL rewrite–specific format: The Apache mod_rewrite rules to use for enforcing canonical host names are: #For sites running on a port other than 80: Verify that the host names were setup correctly by opening a Web browser and going to the sites and to Convert mod_rewrite Rules This is to prevent the Web browser from trying to resolve the domain name by using a Domain Name System (DNS) server. Notice that you are using "_" instead of "." for domain separators. Using Notepad, open %SystemDrive%\windows\system32\drivers\etc\hosts and add the two following lines at the end of the file: 127.0.0.1 www_mysite_com In the Actions pane, click on Bindings, and add a new http binding for port 8088. Start IIS Manager, and then click Default Web Site.

In this example, you will force the use of instead of, so that when a request is made that uses a host name other than you can redirect the request to a canonical hostname. To see how you can convert mod_rewrite rules and verify that the converted rules work correctly, you will implement the common scenario of enforcing canonical host names for a Web site. If you have not yet downloaded the URL Rewrite Module, you can do so at. In this walkthrough, you use the Import Rules feature provided in the URL Rewrite Module to import several mod_rewrite rules into an IIS configuration file. 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.
