how to check if ssl exists on a webserver through php?
- by sarmenhb
i have this function here that i have in a class
function enable_ssl() {
if ($_SERVER[HTTPS]!="on") {
$domain = "https://".$_SERVER['HTTP_HOST']."/".$_SERVER['SCRIPT_NAME'];
header("Location: {$domain}");
}
}
but the problem is when the server doesnt have ssl installed and i have this function initiating the page redirects to a 404 page. i was wondering how i can have this function work only when ssl is installed and working
is it possible?
thanks.
ps: did some google research and couldnt find much of anything.