How to force our website to HTTPS

September 7, 2018 | KB, Tutorial Hosting

If you buy hosting at Jayahost, SSL will automatically be active on the customer's hosting. However, website visitors can still access our website using http:// . To make it safer, we can force visitors to redirect to https:// every time a visitor visits our website.

One way is to enter the following code into our website's .htaccess:

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

How to set using Htaccess

  1. Login to cpanel
  2. Go to File Manager then go to the Public_html folder
  3. There is a .htaccess file there that can be edited.

additional: if you don't find the file, it might be hidden, for cpanel users to bring it up again, click "settings" on the right. then check "show hidden files"

en_GBEnglish (UK)