I need to set a 301 redirection for http requests but couldn't put the pieces I found together and achieve the wanted result. Since I'm not familiar with the concept, I hope title is not misleading.
Right now I'm trying this
<rule name="Redirect to https" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="off" />
<add input="{HTTP_HOST}" pattern="^www.example.com$" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
along with other micromanages rules
I need to set these conditions
https://example.com ---> https://www.example.com
http://example.com ---> https://www.example.com
http://www.example.com ---> https://www.example.com
https://example.com/abc/def ----> https://www.example.com/abc/def
http://example.com/abc/def ----> https://www.example.com/abc/def
http://www.example.com/abd/def ---> https://www.example.com/abc/def
basically, every non http and non www request should ve directed to "https://www..." format.
right now, rule I set is not working on http://example.com format.
I'm not even sure if this is redirection or rewrite but our SEO counselor insist on 301 redirection.
How can I set this rule?