Before redirecting from HTTP to HTTPS, make sure that the SSL certificate, which we offer free for sites hosted on our plans, is already installed.
You can check this by visiting your website with https:// at the beginning of the URL. For example, for www.heberjahiz.com, visit https://www.heberjahiz.com.
There are two ways to force the redirection from HTTP to HTTPS:
How to force redirect from HTTP to HTTPS in cPanel ?
You can automatically redirect visitors to the secure version (HTTPS) of your site for a secure connection. To do so, go to cPanel > DOMAINS > Domains.
This will open a page where you can enable or disable HTTPS redirection.
How to force redirect from HTTP to HTTPS with .htaccess file ?
Just modify or add the following lines to the .htaccess
file of the desired site so that all its visitors automatically access its secure HTTPS version:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
NOTE : If you have additional domains in the public_html
directory, redirect will be a problem, it will redirect all traffic in HTTPS even for domains without certificate.
This code will allow you to redirect to HTTPS, while specifying the domain.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^YourDomain\.com [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]