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 an 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:
- Log in 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 an .htaccess file?.
- Open the 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 an .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 the already written RewriteEngine On.