Checking for HTTPS in PHP


Check if the current request is made over HTTPS.

Source Code

if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
    echo "This is a secure HTTPS connection.";
} else {
    echo "This connection is not secure. Please use HTTPS.";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments