Reputation: 4089
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?
Upvotes: 2
Views: 2451
Reputation: 111
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>
Upvotes: 3
Reputation: 1106
The best way to this is via your DNS records + some IIS configuration.
Upvotes: 1