How to redirect Http to Https Using .htaccess file

Home / Website Design and Management / htaccess file / How to redirect Http to Https Using .htaccess file

we can redirect the non SSL query to your website to SSL port by using .htaccess file.This will help you to access the websites from a secured port(443 of apache) of we server.

in your .htaccess file, you can add following code:


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

It will direct the Normal website URL to its SSL website URL.

How to redirect Http to Https in cpanel

In your Cpanel, go to domain and then redirect link:

Click Redirects link, and then you will go to following page:

 

Leave a Reply

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