In previous article, I mentioned how we can enable caching in IIS and Redirect from non-www to www website using IIS (and Vice-Versa) but now in this article, I have mentioned how we can download and install IIS URL Rewrite and enable it to add Rules in IIS.

Enable or Download IIS URL Rewrite

To enable IIS URL Rewrite, you will have to download it using below links

If you need it for any other langauge, you can visit this link: https://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads

Once, you have downloaded file (for example "rewrite_amd64_en-US.msi"), double-click on it and then you will see screen like below

IIS-url-rewrite-install-enable

You will need to select checkbox for "I Accept the terms..." and then click on "Install" button, then installtion will take few seconds to minutes and you will see Installation Complete screen as below

install-iis-url-rewrite-and-enable

Click on finish.

That's it, once you are done Close and reopen IIS Manager to ensure the URL Rewrite module appears, as shown below

iis-url-rewrite-enable\

Once you are done, now you can write URL rules for a specific website, select website from left-pane and then double-click on "URL Rewrite", then you can click on "Add rule", as shown below

add-rule-IIS-rewrite-rule

Now, you can use to add various Rules, for example, if you want to add permament redirect rule using IIS URL Write, you can click on "Add Rule"-> Then select "Blank Rule"

To redirect a single URL, enter the following configuration:

  • NAME - Enter a name to the new rule.
  • REQUESTED URL - Matches the Pattern.
  • USING - Exact Match.
  • PATTERN - example.html
  • IGNORE CASE - Yes.

You can leave "Conditions" and "Server Variables" as blank and move to "Action Area"

In the Action area, configure the new destination:

On the top-right part of the screen, click on the "Apply" option, then refresh the website to see if rule is working.

You may also like to read:

Enabling CORS in IIS

How to generate CSR on IIS and install SSL on IIS