Redirect all traffic HTTP to HTTPS in IIS

There are many solutions to achieve the goal of redirect all traffic from HTTP to HTTPS in IIS but below is the simplest.

  • After the deployment of SSL Certificate. The site work perfect with HTTPS prefix but will not redirected the HTTP traffic to HTTPS. 
  • Enable the SSL Settings from IIS Manager

  • Open the Error Pages setting from IIS Manager. Add the new Error Page and redirect it to your HTTPS domain name. If there is an error (Lock Attribute) in adding custom error then Change its value to Unlock Attribute in Configuration Editor of  localhost

Now check your website with HTTP prefix and it will redirect it to HTTPS :)