How to Ridirects from HTTPS to HTTP learn 3 super techniques ~ Ofuran

How to Ridirects from HTTPS to HTTP learn 3 super techniques

The are some situation when we need to redirect our particular website to be opened through HTTP instead of HTTPS. To handle this situation you have to write the following line in your .htaccess file.




Problem to find .htaccess file. Go to Right up corner settings, click and check mark hidden files and save this.Then you will find .htaccess file in that hosting directory.


2
3
# Redirect HTTPS to HTTP
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This will redirect your "https://askunion.com" website to "http://www.askunion.com" or "http://askunion.com" website. Firstly check if SSL certificate installed or not, if installed then must stop redirecting https:// in SSL section.  

Read More How to force SSL with .htaccess file

2nd way: using php function:
you have to call the following function at proper place to redirect the webpage.

<?php
function redirectTohttps() {
if($_SERVER[‘HTTPS’]!=”on”) {
$redirect= “https://”.$_SERVER[‘HTTP_HOST’].$_SERVER[‘REQUEST_URI’];
header(“Location:$redirect”); } }
?>
3rd way: using meta tag:

Add the following code of your webpage header

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

Stay connected to get awesome tutorials. 

'