How To Determine HTTP Protocol Using PHP

$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https:" : "http:";
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https:" : "http:";
Categories: How-To's, Technology Tags: $_SERVER, 443, 80, howto, http, https, php, Port 443, Port 80, Protocol, tips
Copyright © 2005-2025 Eric Michael Stone | Random Thoughts, Whims and Fancies…. Powered by WordPress
Leave Your Comment
All fields marked with "*" are required.