Redirect HTTP visitors to HTTPS

If you have a SSL certificate on your website and you need all the HTTP visitors to be automatically redirected to the secured (HTTPS) version of the website to make sure the communications are encrypted, here is the how-to for this purpose.
 
Our shared web hosting are using Windows Server systems with IIS. After the SSL certificate is installed on your website, you may add URL rewrite rule in the web.config file for automatic https redirection.
 
1. Using your text editor, open the web.config file.
 
2.The URL rewrite rule for https redirection to be added is as the following,
 
    <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>
 
3. Simply copy the rule to your web.config file. Save the change.
 
4. Upload the saved web.config file to the web server that hosts your website through FTP or via File Manager of your control panel account.
 
5. The new rule takes effect immediately when the file is uploaded.
 
 
Notes:
 
1. If you do not have an FTP account, follow the tutorial of How To Create FTP Account In WebSite Control Panel to create one.
2. For how to transfer file by FTP, go to How To Upload/Download Files With FTP over SSL (FTPES) for instruction.
3. You may also upload files through File Manager of your control account, the tutorial can be found at How to download/upload files in WebSitePanel Control Panel.
 

Add Feedback