URL redirect rule to redirect all website traffic from http to https

This knowledgebase article applies to Windows Hosting only, below are the Linux instructions

 

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>


https redirect
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

https redirect web.config

  • https, redirect, http, ssl, rewrite, port 80, port 443, url redirect
  • 10 Utilisateurs l'ont trouvée utile
Cette réponse était-elle pertinente?

Articles connexes

How to reset or change your email password from SolidCP

Follow the steps below to change an email password that is hosted on our Windows SSD Hosting...

Email Password Complexity Requirements

For your security and the security of other users hosted on our Windows SSD Web Hosting...

How to Set Website Permissions + Write Permissions

How to set website write permissions using the Windows Hosting Control Panel. Log into the...

How to connect to your MSSQL databases from your website + using SQL Server Management Studio

How to remotely connect to a Microsoft SQL Database Preamble : In order to connect to a...

ASP.net Error <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=

<add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web,...