Saturday, 10 December 2016

How to redirect your website to https on Linux / Cpanel Server

Hello Nice Day!.

I am going to talk about a trick on ssl. 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.

Normally : http://yourwebsite.com
With Redirect  : https://yourwebsite.com

Linux & cPanel

Linux-based accounts use .htaccess files to handle redirection on the server.

Using the following code in your .htaccess file automatically redirects visitors to the HTTPS version of your site:

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

Note : Do not duplicate Rewrite Engine On.

Best Regards,

Don't forgot to visit our website for your Web Design needs. We are the Kushan Dreamworks Web Design Sri Lanka