With all the recent buzz about setting up your site to work with https (SSL/TLS) you may have just had an SSL certificate installed for you or installed this yourself, if you have requested it be installed for you then don't expect them to reconfigure your site an have it automatically redirect to https as the 3rd party may not know your site and may not neceserraly know if your site is ready to have a https redirect activated. A prime example of why this is not done is where a site rediects all requests to http://yourdomain.tld if a redirect to https is activated you will end up with a redirect loop in short breaking your site.

Linux

On a Linux server there are a number of ways to do this, in the webserver configuration, via your .htaccess file or in your hosting panel. If you are using Plesk Onyx then this has features built in to do the redirection for you, if you dont have access to the server configuration files then you will want to add this via a .htaccess fil which I will show you here, this is the most popular way to do this and should be available on any linux apache hosting.

In your webroot create the file .htaccess and add the content 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.

Add a comment

0.0(0 votes)

Previous Post