If you have a secure certificate (SSL) on your website, you can automatically redirect visitors to the secured (HTTPS) version of your website to make sure their information is protected.

Step 1 : Access your cPanel account.

Step 2 : Look for "File Manager" in the "Files" section and click it.

Step 3 : Go to your website's main folder (like `public_html`).

Step 4 : Locate or create the `.htaccess` file and open it.

Step 5 :  Insert this code at the start 

*** For Wordpress WebSite ***

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTPS_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

*** For PHP / Html based website ***

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Step 6 : Save the changes.

Step 7 : Open your site with HTTP; it should redirect to HTTPS.

That's it! Your site will now automatically use HTTPS for better security.

Was this answer helpful? 319 Users Found This Useful (131 Votes)