HTTP to HTTPS
<?php
//echo empty($_SERVER['HTTPS']);
if(empty($_SERVER['HTTPS'])) {
$redirect= "https://www".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
//header("location:$redirect"); //php
return redirect()->to($redirect)->send(); //laravel
}
?>
HTTPS to HTTPS
<?php
//echo empty($_SERVER['HTTPS']);
if(!empty($_SERVER['HTTPS'])) {
$redirect= "http://www".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
//header("location:$redirect"); //php
return redirect()->to($redirect)->send(); //laravel
}
?>