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
- x64 installer (English) or x86 installer (English)
- You can also download it using Web Platform Installer (WebPI) (English)
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
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
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
\
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
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:
- ACTION TYPE - REDIRECT.
- REDIRECT URL - https://qawithexperts.com
- APPEND QUERY STRING - NO.
- REDIRECT TYPE - 301.
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: