Secure socket layer (SSL) is very important for websites these days, hostcry offers free SSL on every package. If you browse your website on google chrome and you don’t have SSL (not redirected to HTTPS) google will show warnings that the website you are visiting is unsafe. And having an SSL certificate is also a ranking factor.
If you don’t have an SSL certificate installed on your domain first you need to install an SSL certificate.
Now that you have an SSL certificate but your users can visit both versions of your website using HTTP and HTTPS, you need to redirect users to HTTPS.
How to redirect from HTTP to HTTPS in Cpanel:
- Login to your cPanel.
- Search for the domains section.
- Click on domains in the domains section.
- This will open all of your domains on the right side of your desired domain you will see the option to enable “force HTTPS redirect”. Just enable SSL.
Now your website should be redirected to HTTPS.
How to redirect the website to HTTPS using a .htaccess file?.
- Open file manager in your Cpanel.
- Go to your website directory and look for the .htaccess file.
- If you can’t find the .htaccess file it might be missing or hidden.
- First show all hidden files.
How to show all Files in cPanel.
Click on Settings at the top right corner of your file manager screen.
Click on show all hidden files and click save.
- If you still can’t find it you need to create a .htaccess file.
How to create a .htaccess file in cPanel.
Click on + File on the top left side of your file manager screen.
Enter .htaccess and click save.
- Right-click and edit the file.
- Enter the following code in your .htaccess file.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
If you have an existing .htaccess file.
- Do not duplicate RewriteEngine On.
- Make sure RewriteCond and RewriteRule follow already written RewriteEngine On.