Http to Https Url redirection RRS feed

  • Question

  • My requirement is straight forward. I have installed certificate , in binding added thee certificate. site is working in Https(e.g. https://abc) as expected. 

    But the requirement is , if any user Enters http://abc then it should redirect to https://abc

    I have added the URL rewriting module. Created the Rule. The web.config file code as below

                    <rule name="http to https" stopProcessing="true">
                        <match url="(.*)" />
                            <add input="{HTTPS}" pattern="^off$" />
                        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />

    But still its not working. help me out. Its straight forward. i need Http should redirected to Https
    • Moved by CoolDadTx Tuesday, August 29, 2017 1:48 PM ASP.NET related
    Tuesday, August 29, 2017 11:11 AM

All replies

  • Please post questions related to ASP.NET in the ASP.NET forums.

    And you're missing the enabled attribute true in the rule, the match rule is just .* (no parens) and the action should include appendQueryString=false.

    Tuesday, August 29, 2017 1:48 PM
  • I tried that as well before posting in Forum , but it didn't worked for me. This is related to only.This is the piece of code from Web.config.
    Wednesday, August 30, 2017 6:37 AM