RewriteEngine OnRewriteCond %{SERVER_PORT} 80RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
If you believe the possibility exists then you should seek it out. Keep moving, whatever it takes. Even if the way ahead lies through a river of mud.
RewriteEngine OnRewriteCond %{SERVER_PORT} 80RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
Open web.config and insert the following
<system.webServer>
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false"/>
<conditions>
<add input="{HTTPS}" pattern="off"/>
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent"/>
</rule>
</rules>
</rewrite>
</system.webServer>
If you already have <system.webserver> headings, just insert this code in there and remove the duplicate heading.
If you using Lets encrypt for SSL you will need to do the following instead
<rewrite>
<rules>
<rule name="Allow LetsEncrypt" patternSyntax="Wildcard" stopProcessing="true">
<match url=".well-known/*" />
<action type="None" />
</rule>
<rule name="Redirect HTTP to HTTPS" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>
</rules>
</rewrite>