This knowledgebase article applies to Windows Hosting only, below are the Linux instructions
- How to force a https redirect within DirectAdmin
- cPanel - Redirect all website traffic from http to https with the htaccess file
After installing an SSL on your website hosting on our Windows servers you'll most likely want to force or redirect all traffic to https
Follow the steps below to add a redirect rule to your web.config that will force all traffic on port 80 to port 443 (SSL / https)
Download a copy of the web.config file which can be found in your domain's wwwroot
Open the file using a text editor such as notepad ++
Add the rewrite rule immediately after the following :
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ZADNS 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>
Save the web.config and upload it to your website's wwwroot directory, overwriting the existing web.config
Your web.config should look simlar to the image below