In the following example we will redirect HTTP to HTTPs using URL Rewrite:

Edit your web.config file.

Paste the following into it just above "</configuration>":

    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Redirect to HTTPS" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Temporary" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>


Note adjust where required.
Esta resposta foi útil? 1 Utilizadores acharam útil (1 Votos)