We want to redirect all incoming requests to https://www.domain.com
We have tried dozens of code snippes from the web but none covered all the examples from above.
Can anyone help with an appropriate web.config file for IIS?
I got the same problem. This rule works for me.
<rewrite>
<rules>
<clear />
<rule name="Redirect non-www OR non-https to https://www">
<match url=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^domain.com$" />
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://www.domain.com/{R:0}" redirectType="Permanent"/>
</rule>
</rules>
</rewrite>
The best way to this is via your DNS records + some IIS configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With