advanced code snippet search
StevenW721 on 07/09/10
ssl
07/09/10 01:22am
function forceSSL (){ // force SSL usage and use of WWW if (($_SERVER["SERVER_PORT"] != 443)) { header("Location: " . "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]); exit(); }}
Report this snippet Tweet
You can also use the 'HTTPS' server variable for cases where SSL may not be serviced by the default port 443: if($_SERVER['HTTPS'] == 'off')
Comment:
You need to login to post a comment.
You can also use the 'HTTPS' server variable for cases where SSL may not be serviced by the default port 443: if($_SERVER['HTTPS'] == 'off')