You can do parse_url($REQUEST_URI), then access the scheme value as:
$chkScheme = parse_url($_SERVER['REQUEST_URI]');
if($chkScheme[scheme] != "https") {
die("Wrong protocol");
## Or do a header location ##
header("Location:https://".$_SERVER['PHP_SELF']."");
}
Note that it is also possible to set wether or not cookie-values are to be sent, in case the protocol happens to be wrongly set in the client:
## This cookie will only be transmitted if the protocol is https ##
$secure = "1";
setcookie("name", $value, $expire, $path, $domain, $secure);
But the right place to set the request protocol is really in apache - I'll look it up 😉
knutm