Redirect from HTTP to HTTPS

After you install the certificate on the server, you must force the redirect from unsecured HTTP to secured HTTPS. Otherwise your website will be available and work on two protocols, secured and insecured (it allows the use of an unsecured protocol as well). This fact causes that your website looks like two different sites for search engines and it harms your SEO. This tutorial will help you redirect your website permanently to HTTPS.

Apache Webserver

If you are using the popular Apache Web server, you can easily redirect all traffic from unsecured HTTP to HTTPS. When a visitor goes to your site will be redirected to the secure HTTPS protocol.

Logo Apache Web server

If you are a server administrator, you can set the redirect in httpd.conf file using configuration below. If you are not an administrator and you use a >webhosting, you can set the redirect using .htaccess file. Put .htaccess with this configuration to the folder you want to redirect to HTTPS:

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

The server must allow you to use module mod_rewrite, but it's not a problem for most webhosting providers.
If you do not want to redirect the entire site, but only one page , then use this configuration:

RewriteEngine On
RewriteRule ^apache-redirect-http-to-https.html$ https://www.yoursite.com/apache-redirect-http-to-https.html [R=301,L]

Microsoft IIS 7 and more recent

Use the following procedure to redirect all communication to the Microsoft server using IIS 7 (and later).

Logo Windows Server 2008 R2

The server requires Microsoft URL Rewrite Module, which must be installed on the server. Our process is performed after installing a TLS certificate and assigning it to a domain. Our videotutorial will help you with this task Installation of TLS certificate on IIS server.

Check the SSL Settings option of your Web Site and make sure that the Require SSL option is disabled.

Modifying Web Site Settings in IIS
Paste the following code into the file web.config in the main directory of the website, which is the main XML configuration file for ASP.NET applications. <xml version="1.0" encoding="utf-8" ?>
  <configuration>
   <system.webServer>
    <rewrite>
     <rules>
      <rule name="HTTP to HTTPS redirect" stopProcessing="true">
       <match url="(.*)" />
        <conditions>
         <add input="{HTTPS}" pattern="off" />
        </conditions>
       <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
     <rule>
     </rules>
    </rewrite>
   </system.webServer>
  </configuration>

More information about configuring this file can be found in the Microsoft MSDN Library.

Then just visit your domain http://www.domain.com and test the functionality of the new redirect.

Server nginx

Logo nginx

To redirect your website to HTTPS on Nginx, add the bold line to your configuration:

server {
listen 80;
server_name domain.com www.domain.com;
return 301 https://$host$request_uri;
}

server {
listen 443;
server_name domain.com www.domain.com;

ssl on;

[....]
}

Please feel free to contact our Customer Support who will help you to choose a certificate and to answer any questions.