How to Enable mod_rewrite on IIS Web Server?

Microsoft URL Rewrite module offers you similar functionality like Apache mod_rewrite module. It is fully integrated into the web.config file (an excellent equivalent of .htaccess file of Apache). URL Rewrite Module in IIS 7 (7.5 and 8.0) provides import feature that makes conversion of Apache mod_rewrite rules to IIS URL rewrite rules too easy. This module comes pre-installed with all AccuWebHosting Windows VPS, guest visitors who want to enable mod_rewrite on IIS can download the Rewrite Module here.

URL Rewrite Module tries to convert Apache mod_rewrite rules to equivalent IIS URL rewrite rules. However, due to architectural differences between Apache and IIS web servers, all mod_rewrite rules may not be converted. Hence, we recommend that you completely understand the rewrite rule functionality before you begin the conversion process. Once Apache mod_rewrite rules have been converted to IIS URL rewrite rules, verify that corresponding IIS rewrite rules function same as Apache rewrite rules.

 

NOTE : IIS URL Rewrite module will only convert rules that follow Apache mod_rewrite syntax. Any other formats of rewrite rules would not be recognized or could be converted incorrectly.
  1. Start IIS Manager (Start >> Run, type inetmgr and hit enter).

    IIS Services

  2. In IIS, select the Default Web Site.
  3. Under Features View, click URL Rewrite.

    URL Rewrite



  4. At right hand side, under Actions pane, click on Import Rules.

    Import Rules

  5. Copy your mod_rewrite rules from .htaccess file and paste them into the Rewrite rules text box.

    Import mod-rewrite Rules

  6. Tree View tab will instantly show the result of this conversion. XML View will show how these rules are stored in the web.config file.
  7. After rule conversion, rules were assigned with default names. You can change the rule name by selecting rule from Tree View, right-click on rule name, and select Rename from context menu.

    Rename Rules

  8. Click Apply to save the converted rules to the web.config file.

→ Looking to set HTTP to HTTPS redirection in IIS? Please refer to set redirection in IIS for more details.


Related Articles

How to install Dotnet nuke on Windows server ?

Following are the steps to install Dotnetnuke on Windwos server. Download Latest version of...

How to open Firewall Ports on Windows Server 2012?

Following article will help you to open ports in Windows Firewall with Windows Server 2012...

How to add TXT record in windows server DNS?

TXT record allows a domain administrator to enter text into the Domain Name System (DNS).  You...

How to force HTTPS from web.config file?

The Microsoft URL Rewrite Module 2.0 for IIS 7 and above enables IIS administrators to create...

How to Install Telnet Client in Window and Linux?

Telnet Client allows you to connect to remote and local computers via Telnet protocol. Telnet...

  • 1 Users Found This Useful

Was this answer helpful?