If you have a website with a SSL certificate, you may want to redirect all visitors to the HTTPS version of your website by default.
This you can realize with the web.config file of your root directory, if your using IIS 7 or higher.
Just add the bold code part to your web.config file.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
No comments:
Post a Comment