After a certification authority issues a SSL/TLS certificate you might probably want to force the Web server to use only secure connections by switching any http connection to a https one. Our Cloud Hosting service is based on Windows Server so you cannot use a .htaccess file to do that.
However, you can simply change your web.config file, which contains most of the settings that you can manage, to add a new rewrite rule that ensures that all the http connections will be automatically switched to secure mode:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <!-- Enable to force redirect to HTTPS --> <rule name="Redirect to https" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
That code is a complete web.config file, the minimum required to enforce secure connections. In most cases you probably already have an existing web.config file so you can simply add the rule, that is the part between the and lines.
1
Leave a Comment