If you need to force HTTPS or secure connections on your website, this can be done via a 301 redirect using the .htaccess file. To do this, please follow these steps:
- Log in to your cPanel account and navigate to the File Manager.
- Enter the directory of the domain you would like to force HTTPS on. For your primary domain, this will be the public_html folder.
- Edit the .htaccess file. You may need to unhide or create the file.
- Enter the code below and click Save.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]