How To Enable mod_rewrite On IIS

The IIS mod_rewrite is a helpful URL rewriting feature of IIS. It lets you rewrite URL by implementing custom rules and get the most out of your web application. Microsoft URL Rewrite module offers you similar functionality like Apache mod_rewrite module.

URL Rewrite Module tries to convert Apache mod_rewrite rules to equivalent IIS URL rewrite rules. It also plays an important role in SEO, preventing unwanted traffic or redirecting requests. In this tutorial, you will learn how you can enable the mod_rewrite feature on IIS.


  • URL Rewrite module Installer
  • Correct Registry settings
  • Domain name

Step 1:

Click on Start menu. Click on Control Panel. Click on Program & Features. Enable IIS from the Add/Remove feature from the control panel if it is not selected at first.

How To Enable mod_rewrite On IIS

After enabling IIS, Install the URL Rewrite module if it is not previously installed. The module can downloaded from this website.

You might face an issue if you have a windows 10 machine. There is a workaround for that. Click on Start menu, and Click on Run. Open the Registry editor by typing in regedi  at the Run menu.

Inside the Registry, navigate to


Make changes in the MajorVersion and set the Decimal to 9. Hit F5 in the registry editor. Now Install the Rewrite module and then change back the decimal value back to 10 and close the Registry editor.

Step 2:

To verify if the installation of IIS is successful, type localhost in the URL section of your browser. Make sure other tools like Xampp , wamp are turned off as it may interfere with localhost of IIS.

How To Enable mod_rewrite On IIS

The above information will be displayed if IIS has been enabled successfully on your machine.

Step 3:

Click on Start. Start IIS Manager by running inetmgr on the Run window (window key+R)

How To Enable mod_rewrite On IIS

Step 4:

Open the IIS Manager and Click URL Rewrite from the IIS menu window.

How To Enable mod_rewrite On IIS

Step 5:

Click Open Feature from the right side menu while selecting URL Rewrite.

How To Enable mod_rewrite On IIS

Step 6:

Click Add Rule from the right side menu. A window to add new rule will be displayed with different rules like Inbound rule, outbound rule and SEO options. Click on Blank Rule.

How To Enable mod_rewrite On IIS

Step 7:

Add the values in the Edit Inbound Rule window as mentioned in the following screenshots. This rule will redirect all the sites to https from http.How To Enable mod_rewrite On IIS

How To Enable mod_rewrite On IIS

Put {HTTPS} as the condition input and ^OFF$ as the pattern. You can tick the Ignore Case option. Click Ok.

How To Enable mod_rewrite On IIS

On the Redirect URL, add https://{HTTP_HOST}/{R:1} Click on Apply on the top right corner to apply the rule.

Step 8:

Now, when you try to access a http URL, the mod_rewrite feature will detect a HTTP URL and then automatically redirect it to https.


By following the above-mentioned steps, you can successfully enable mod_rewrite feature on IIS.

Check out these top 3 Best web hosting services

Was this article helpful?