To force the HTTPS connection on your website, add the following lines inside the website’s .htaccess file:
- Go to File Manager in your hosting panel
- Open .htaccess inside the public_html folder. If you can’t locate it, make sure to create or unhide it.
How to Locate an Open .htaccess File In Case You Didn’t find it?
If you are using cPanel, the process is more or less similar
1.Access File Manager -> public_html.
2.If you can’t find the file, go to the Settings on the upper right menu and tick the Show Hidden Files option to enable viewing.
IMPORTANT! This only applies to cPanel-based hosting platforms.
3. Scroll down to find RewriteEngine On and insert the following lines of code below it:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]