Hi, This is the PHP Script to redirect all the http users to the https
<?php
if($_SERVER['HTTPS']!="on"){
if(substr($_SERVER['REQUEST_URI'],0,1)=='/'){
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}else{
header('Location: https://'.$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI']);
}
}
?>
<?php
if($_SERVER['HTTPS']!="on"){
if(substr($_SERVER['REQUEST_URI'],0,1)=='/'){
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}else{
header('Location: https://'.$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI']);
}
}
?>
0 comments:
Post a Comment