1) Download and install the URL Rewrite 2.0 module to your IIS8 server:
64bit URL Rewrite Module Download
32bit URL Rewrite Module Download
2) Once installed, open IIS Manager, expand the Sites container and select the website you wish to configure the http redirection.
3) Once highlighted, doubleclick the URL Rewrite option in the right hand pane. Select Add Rule and configure the following:
NAME
- Select: Blank Rule
- Name: http to https
- Match URL – Requested URL: Matches the Pattern
- Match URL – Using: Regular Expression
- Pattern: (.*)
CONDITIONS
- Conditions: Add
- Condition Input: {HTTPS}
- Check if input string: Matches the Pattern
- Pattern: ^OFF$
- Click OK
ACTION
- Action type: Redirect
- Redirect URL: https://{HTTP_HOST}/{R:1}
- Redirect type: See Other (303)
- Click Apply
Requests to your site via HTTP should now be redirecting to HTTPS.
Works perfectly, thanks!
what should i mention in the Redirect URL?do i have to mention same as shown in the action asRedirect URL: https://{HTTP_HOST}/{R:1} . or do i need to mention my website link which is going to be redirect.
You should be able to literally use https://{HTTP_HOST}/{R:1}
Thanks for that. Very clear instructions.
I get a following warning ‘the Rule back reference “1” is not valid’ and when I browse to the http website, I see the following error.
HTTP Error 500.50 – URL Rewrite Module Error.
The expression “https://{HTTP_HOST}/{R:1}” cannot be expanded.
Make sure you put the parenthesis around the .* for the pattern.
Thanks, that worked quite well.
I couldn’t apply it to the ‘Default Web Site’ like I originally intended, but it worked when I put it on the specific subfolder I needed.
Great instructions!
Although I had to to untick “Require SSL” under SSL Settings to get it to work.
Wow, thanks Gaston. I struggled the whole morning why this wasn’t working and yes, switching off the “require SSL” made it work. EUREKA !!!!!
Thank you very much. Worked a charm, saved me a bunch of time.
Thank you very much for this clear instruction.
One thing though, I had to change Pattern: ^OFF$ to a simple off to make it work (on Windows 2012 r2)
Thank you. It worked perfectly
Does this work with exchange 2013?
According to the IIS blog (even see author’s recent 2016 comment), the Redirect type should be set to: Permanent (301).
https://blogs.msdn.microsoft.com/kaushal/2013/05/22/http-to-https-redirects-on-iis-7-x-and-higher/
What’s the difference in setting the two: 301 vs 303?
This doesn’t appear to work for Safari browsers, but does work for Chrome and IE – any reason why safari would not follow the redirect?
Thank you very much, spot on!