There are several ways to redirect your website from HTTP to HTTPS. The easiest method is to use the Force HTTPS Redirect option available in cPanel.
Method 1: Using cPanel
- Log in to your cPanel account.
- Go to Domains.
- Find the domain you want to configure.
- Turn on Force HTTPS Redirect.
Once enabled, visitors accessing your website using http:// will automatically be redirected to https://.
Method 2: Using .htaccess
You can also force HTTPS using an .htaccess file.
- Open File Manager in cPanel or connect to your account using FTP.
- Open the
.htaccessfile in your website's document root. - Add the following lines:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- Save the file and visit your website using HTTP to verify that it redirects to HTTPS.
Important
Make sure an SSL certificate is already installed and working for your domain before enabling an HTTPS redirect. Otherwise, visitors may receive an SSL connection error.