Force redirect your website to HTTPS using .htaccess

There are many ways to redirect your website from HTTP to HTTPS, but I found this as the easiest and best way to do this.

Login to cpanel and edit the file .htaccess

Add the following code

RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

You site now will be automatically redirected to Https.

3 thoughts on “Force redirect your website to HTTPS using .htaccess”

Leave a Comment

Your email address will not be published. Required fields are marked *

Tweet
Share
Share
Pin