IIS URL REWRITE HTTPS

ANIS 136 Reputation points
2021-07-18T17:25:18.833+00:00

Hello,

I would like to know how to rewrite URL from http to https.

I have found many documentation on the web about this subject but all of them have the same behaviour :

initial URL : http://mydomain/mypage1

new URL : https://mydomain/

I would like to have the following behaviour :

initial URL : http://mydomain/mypage1

new URL : https://mydomain/mypage1

thank you four your help.

Internet Information Services
0 comments No comments
{count} votes

Accepted answer
  1. Bruce Zhang-MSFT 3,751 Reputation points
    2021-07-19T03:11:55.273+00:00

    Hi @ANIS ,

    In my test, this rule can work well. You can try it.

    <rule name="http to https">  
                        <match url="(.*)" />  
                        <conditions>  
                            <add input="{HTTPS}" pattern="^Off$" />  
                        </conditions>  
                        <action type="Rewrite" url="https://{HTTP_HOST}/{R:1}" />  
                    </rule>  
    

    115753-2021-07-19-110436.jpg

    If it still cannot work for you, you can enabled failed request tracing to find out issue.


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Bruce Zhang

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.