Heart Internet Redirect to HTTPS

Once you have purchased your SSL certificate, steps are taken to  to avoid duplicate content and a replacement of the page by its https version.

Search engines don’t like duplicate content. Without the addition of a redirect to the https version of the page it will look like two pages having the same content.

Tell the browser to use the https page version. a properly created redirect will transfer your website from the old unencrypted page to the new encrypted equivalent. To be avoided is the rather basic redirect to the root of the website, with the encryption.

A typical redirect from http to https is shown below

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

Slightly different redirect requirements for Heart Internet infrastructure:

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

I found that the position for this is after the WordPress defined section.

for example as shown below:

DirectoryIndex index.cgi index.php

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

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

References

Dream Host: Force your site to load securely with an .htaccess file

Heart Internet: How to use .htaccess to prevent duplicate content

Host Papa: How to automatically redirect HTTP traffic to HTTPS

inMotion Hosting: Forcing HTTPS Using the .htaccess