php restrict https
Posted: Wed Aug 04, 2010 7:25 pm
There are some situation that you need to only allow access to your php ,pages only through SSL. You may use the following code at the beginning of the page. This will reload the page with https.
Code: Select all
if($_SERVER["HTTPS"] != "on"){
header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
exit();
}