I need to force every request to https://www.mysite.com (always with https and www)
The site is hosted by GoDaddy, and I need to do this through the IIS7 URL rewriter module.
I was able to redirect HTTPS with the following code:
<system.webServer>
<rewrite>
<rules>
<rule name="Canonical Host Name" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^mysite\.com$" />
</conditions>
<action type="Redirect" url="https://www.mysite.com/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
Testing
I assume the condition is not met when I log in to www.mysite.com in the browser, so there is no redirect, and the page is used as HTTP instead of HTTPS.
, , , .
!