Problem with url rewrite on iis 8.5 server 2012 r2

Gary Tarr 1 Reputation point

I am trying to rewrite any http request to an https request. Below is my web.config file. It seems like the setup is correct but it is not working. If I try to visit my site with an http request, the site appears but does not automatically redirect to https. Any ideas would be much appreciated.


<?xml version="1.0" encoding="UTF-8"?>
<remove value="default.aspx" />
<remove value="iisstart.htm" />
<remove value="index.htm" />
<remove value="Default.asp" />
<remove value="Default.htm" />
<rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" />
<add input="{HTTPS}" pattern="^OFF$" />
<action type="Redirect" url="https://{HTTP_HOST}/{REQUEST_URI}" appendQueryString="false" />

Internet Information Services
{count} votes