$serverPort = $_SERVER['HTTP_PORT'];
//check if its not secure port
if("443" != $serverPort) {
header("Location: https://".$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
exit;
}
?>
So, the above code ensures that the page runs under https i.e. port 443 and
is securely displayed. Hope it helps someone.
3 comments:
Hey this is lovely article. Your all posts are unique. Nice, really you are genius guy.
How I can use it with php forms
Hi,
You can use it at top of the page.
Post a Comment