Redirect HTTP to HTTPS

When you install an SSL certificate to enable your site to work with TLS over HTTP (HTTPS) by default this will not automatically redirect all visitors to your your website onto the HTTPS security layer which we would recommend.  Before this redirect can be enabled on your website hosting, your site code should be checked by the sites' developer to ensure that the sites code is ready for https (i.e. no hard links within it going back to http which could force a redirect loop and effectively break the site.)

There are a number of different ways that you can perform the redirect to https on your site and below are 2 examples of how to do this on the Linux and Windows hosting platforms.

Linux

In your webroot create the file .htaccess or if it already exists add to it with the below and save.


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

After saving the file the changes should be imidiate and the site should now be redirecting to https.

Windows

If you are using the Windows IIS hosting platform then you will want to create the redirects in your web.config file.

If you already have a web.config file then you will need to add to it, else create a new file in your webroot and save

<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="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>   
    </rules>
</rewrite>
</system.webServer>
</configuration>

Once you have added the content and saved the file you should now see the site is redirecting to https.

  • ssl, redirect, windows, linux
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Add Your SSL Certificate To Plesk

To add an already purchased SSL certificate to your hosting for your website you will need to...

SSL Validation

The main difference between each validation type is how much validation must be performed by the...

What does the SSL Warranty actually mean?

When you're choosing which certificate is best for you, one thing to consider is the warranty...

SSL Certificates

What is SSL/TLS? SSL (Secure Sockets Layer) is the standard security technology for establishing...

Install Basic SSL certificate

To install a basic SSL certificate you will firstly need to login to your hosting panel.   Once...