locked
how to redirect http to https using url rewrite RRS feed

  • Question

  • User-1740395346 posted

    Hi,

    Can someone share the expression code that would redirect a user from http://secure.site.com to https://secure.site.com ?

     

    {HTTPS} <---How do i use this? with url rewrite.

     

    I found on piece of code buy did not work for me. in the conditions it was {HTTPS} and ^OFF$

     

    However; i could not get this to work.

     

    thanks

    Thursday, June 11, 2009 6:08 PM

Answers

  • User-1740395346 posted

     Got it to work.

     Had to create a seperate website to do a redirect from.

     Create a site that was http:// only and in the url redirect did a

           <rewrite>
                <rules>
                    <rule name="redirectALL" stopProcessing="true">
                        <match url=".*" />
                        <action type="Redirect" url="https://{HTTP_HOST}/{R:0}" redirectType="Permanent" />
                        <conditions>
                            <add input="{HTTPS}" negate="true" pattern="^ON$" />
                        </conditions>
                    </rule>
                </rules>
            </rewrite>
    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, June 11, 2009 6:24 PM
    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, June 11, 2009 11:14 PM

All replies

  • User-1740395346 posted

     Got it to work.

     Had to create a seperate website to do a redirect from.

     Create a site that was http:// only and in the url redirect did a

           <rewrite>
                <rules>
                    <rule name="redirectALL" stopProcessing="true">
                        <match url=".*" />
                        <action type="Redirect" url="https://{HTTP_HOST}/{R:0}" redirectType="Permanent" />
                        <conditions>
                            <add input="{HTTPS}" negate="true" pattern="^ON$" />
                        </conditions>
                    </rule>
                </rules>
            </rewrite>
    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, June 11, 2009 6:24 PM
    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, June 11, 2009 11:14 PM