Modern web browsers like Google Chrome and Firefox started to show a website visitor insecure warnings on sites without SSL certificates. If your website is not running on HTTPS or does not have an SSL certificate, your website will show insecure to the visitors. Therefore, using an SSL-encrypted connection for safety, accessibility or PCI compliance reasons is necessary. It becomes very important to redirect from HTTP to HTTPS.
This article will explain how to redirect your website's visitors from HTTP to HTTPS. You need to have an SSL certificate installed on your hosting account or server in order for this method to remove the insecure warning from the visitor's browser while on your website.
First you need to create a .htaccess file if it does not exist or modify an existing file on your server or hosting account.
Choose one of the following ways to create/edit a .htaccess file
Before making any modifications to an existing htaccess file, be sure to make a back of of the file before editing. You can easily backup the htaccess file by opening it using a text editor and copy past the content to another file or make a copy of the file and name it htaccess_backup for example.
Copy the following code and paste it in your htaccess file
Last update: December 4th, 2018