Redirect HTTP to HTTPS in IIS 10 / Windows 2016
I am looking to redirect HTTP access to HTTPS in IIS 10 / Windows 2016 for a web site that I'm working with.
I was able to add the HTTP REDIRECT "role" to the server - and can see that in IIS. But setting it up seems a bit more complicated then a single setting in IIS.
Thanks!
Steve
Re: Redirect HTTP to HTTPS in IIS 10 / Windows 2016
Re: Redirect HTTP to HTTPS in IIS 10 / Windows 2016
Quote:
Originally Posted by
szlamany
I am looking to redirect HTTP access to HTTPS in IIS 10 / Windows 2016 for a web site that I'm working with.
I was able to add the HTTP REDIRECT "role" to the server - and can see that in IIS. But setting it up seems a bit more complicated then a single setting in IIS.
Thanks!
Steve
@Steve, Does this helps?
https://docs.microsoft.com/en-us/iis.../httpredirect/
Re: Redirect HTTP to HTTPS in IIS 10 / Windows 2016
You can use URL rewrite in IIS and use below code in web config
Code:
<rewrite>
<rules>
<rule name="http to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
Or you can also do it using ASP.NET
check this link
https://qawithexperts.com/questions/...ttps-in-aspnet