Microsoft Azure Open Source Development Support Team Blog

Support for Open Source Technologies on Microsoft Azure App Service

Converting Apache .htaccess rules to IIS web.config using IIS Manager for Azure Websites

Web.config – the settings and configuration file for a Windows IIS Web Application.

.htaccess – the default filename of the directory-level configuration file for a Linux Apache Web Application.

 


Disclaimer: The URL Rewrite tool by IIS Manager gives you suggested web.config rules. Since it is not a one-to-one conversion, the recommendation is to test these rules in a development environment.


If you’re looking to create rewrite rules for the URL Rewrite Module, please see the article here.

 

These screenshots were taken from IIS Manager 8.6.9600 and assume you have URL Rewrite Installed.

To convert .htaccess rules to web.config, launch IIS Manager.

 

Step 1. In the connections pane, select your site

 

Step 2. Double-click on URL Rewrite

 

 

Step 3. On the right, select “Import Rules”

 

 

 

 

 

Step 4. Copy-paste your .htaccess file or select it under “Configuration file”

 

 

 

Step 5. Click the “Xml view” to view in the web.config format

 

Now that you have the rules in web.config format, validate and verify the rules on a development server.