How to force showing website through https

As you might know websites can be opened through http and https protocols. https is a secure version of http and it is better to use https when any sensitive data is submitted or viewed on a website. Moreover Google prefers websites offering content through https.

We assume that you already configured https for your website as described here. But in addition to those changes we have to redirect customers to a secure protocol when they try to open a website by entering a domain name in the address bar. It can be achieved by adding a few lines to .htaccess file. Here is a simple setup of .htaccess to redirect users to https urls.

RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !on 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Please Wait!

Please wait... it will take a second!