IIS doesn’t have a feature to redirect http to https. There are a number of ways to achieve this, but in this post I will show you to do it by modifying IIS custom error page (403.4).
- Create a file called SSLRedirect.asp in your webroot with the following content:
Or if you want to redirect it to a single URL, you can change those lines above with this instead
<% Response.Redirect(“https://www.YourDomain.com/”) %>
- Open the IIS MMC tool, select properties for your site, go to the directory security tab, click the edit button at the bottom in secure communications, and then check “Require secure channel (SSL)” option.
- In the IIS MMC tool under your site’s properties, go to the custom errors tab, select the 403;4 error type, edit its properties to be a URL in your site and change it to
- Still in the IIS MMC tool, select the properties for the custom error file you have createdpreviously (SSLRedirect.asp), go to the file security tab, click the edit button at the bottom in secure communications, and then UN-check “Require secure channel (SSL)” option.
That’s it! Now the visitor will be automatically redirected to https whenever they access the http. Thank you goes to Paul Wilson and IISFAQ.