locked
HTTP to HTTPS - URL Rewrite RRS feed

  • Question

  • User-462152098 posted
    Hi,

    I'm using an instance Amazon EC2 - Windows Server 2012 R2 & IIS 8.5.

    I've got a problem with my URL Rewrite, i would like to redirect HTTP to HTTPS like this :
    http://mydomain.com --> https://mydomain.com

    My web.config :

    <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}" redirectType="SeeOther" />
    </rule>

    I've unchecked the "Require SSL" in the SSL settings.

    But the redirection still not working :-(

    What can i do ?

    Thanks






    Wednesday, February 17, 2016 6:23 PM

Answers

  • User-462152098 posted
    Thanks a lot !!! You give me a very good idea with the binding !

    I've to add a site bindings with simple "http", before only got the "https" in the site binding, now go the both, "http" and "https".

    But i've also change ma url rewrite rules, now it looking like this :

    <rule name="http to https" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
    <add input="{HTTPS}" pattern="OFF" />
    </conditions>
    <action type="Redirect" url="https://itac.pro/{R:0}" redirectType="Found" />
    </rule>

    Thanks a lot !!
    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, February 18, 2016 9:20 AM

All replies

  • User-736483138 posted

    Try just Off in the {HTTPS} pattern area without the other regex characters.

    Like below:

    <add input="{HTTPS}" pattern="Off" />

    Wednesday, February 17, 2016 8:19 PM
  • User-462152098 posted
    Thanks but that not working :(
    Wednesday, February 17, 2016 9:02 PM
  • User1278090636 posted
    Hi,

    Did you bind your website with two ports 80(http) and 443(https)?
    I tested your redirect rule on my side, it works fine. Perhaps there was something wrong with your binding settings.

    Best Regards,
    Jean
    Thursday, February 18, 2016 8:46 AM
  • User-462152098 posted
    Thanks a lot !!! You give me a very good idea with the binding !

    I've to add a site bindings with simple "http", before only got the "https" in the site binding, now go the both, "http" and "https".

    But i've also change ma url rewrite rules, now it looking like this :

    <rule name="http to https" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
    <add input="{HTTPS}" pattern="OFF" />
    </conditions>
    <action type="Redirect" url="https://itac.pro/{R:0}" redirectType="Found" />
    </rule>

    Thanks a lot !!
    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, February 18, 2016 9:20 AM