You can follow any of the three methods mentioned below for redirecting your website from HTTP to HTTPS-

Method 1: Using a .htaccess file

You can use the following code and edit the .htaccessfile for moving from HTTP to HTTPS-

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Usually, the websites often use an HTTP protocol as the default protocol for handling all the critical information. Still, with https, you get various security and other benefits for your website.

Method 2: Using a PHP function

You can also use the following .php function for redirecting your website. You just need to call the function in the right place from where you wish to get the redirection.

< ?php

function redirectTohttps() {

if($_SERVER[‘HTTPS’]!=”on”) {

$redirect= “https://”.$_SERVER[‘HTTP_HOST’].$_SERVER[‘REQUEST_URI’];

header(“Location:$redirect”); } }

?>

Method 3: Using an HTML Meta Tag

The methods discussed above are sufficient enough for making a move to HTTP from HTTPS. Using an HTML Tag might not be that effective as compared to the previous two. Still, you can use it if you fail to use the “mod rewrite.”

Make sure to add the following to your web page header-

< meta http-equiv=”Refresh” content=”0;URL=https://www.yourdomainname.com” />

Popular Posts You May Read

Explore more hosting insights, tips and industry updates.

How to Create An Email List In Horde Webmail Client

Horde helps you establish multiple address books, but you must first learn how to create…

FrontPage 2002 Server Extensions : FP2002: Error Message

Normally the errors occur when upgrade is done on a backup domain controller or restrictions…

IIS 10 Features view – What is New?

Summary: In all the web hosting news you might have noticed the buzz around Windows…