The IIS URL Rewrite Module 2.1 for IIS7+ may be votre friend. The module can be downloaded depuis IIS URL Rewrite. Using the URL Rewrite Module et URL Rewrite Module 2.0 Configuration Reference explain how to use le module.
Once le module is installed, you can créez un host wide redirect using IIS Manager. Select URL Rewrite, Add Rule(s)..., et Blank rule.
Name:
Redirect to HTTPS
Match URL
Requested URL: Matches the Pattern
Using: Wildcards
Pattern: *
Ignore case: Checked
Conditions
Logical grouping: Match Any
Condition input: {HTTPS}
Check si input string: Matches the Pattern
Pattern: OFF
Ignore case: Checked
Track capture groups across conditions: Not checked
Server Variables
Leave blank.
Action
Action type: Redirect
Redirect URL: https://{HTTP_HOST}{REQUEST_URI}
Append query string: Not checked
Redirect type: Permanent (301)
Apply le rule et run IISReset (or click Restart in le IIS Manager)
Alternativement, après installing le module you could modify le applicationHost.config file as follows:
`<system.webServer>
<rewrite>
<globalRules>
<rule name="Redirect to HTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" ignoreCase="true" negate="false" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="false">
<add input="{HTTPS}" ignoreCase="true" matchType="Pattern" negate="false" pattern="OFF" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
</rule>
</globalRules>
</rewrite>
</system.webServer>