How to set the redirection from http to https? Print

  • 349

Redirect Website from HTTP to HTTPS:-

If you are using this on a shared hosting platform. First, you need to ensure the hosting provider offer SSL and enabled for your site.

  • Login to cPanel and go to the files manager where you can find .htaccess file
  • Add the following at the end of the 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 the lines beginning RewriteCond and RewriteRule immediately follow the already existing RewriteEngine On.

Was this answer helpful?

« Back

Powered by WHMCompleteSolution