Check HTTP or HTTPS protocol in PHP You might be in some case need to check HTTP or HTTPS status of requested URL.
1 2 3 4 5 6 7 8 9 10 |
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) { // HTTPS } else { // HTTP } |