How to get site URL protocol?
Notes: you should look also for HTTP_X_FORWARDED_PROTO (e.g. if proxy server) relying on 443 port is not safe (https could be served on different port) REQUEST_SCHEME not reliable if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { $protocol = 'https'; } else { $prot..
Code Snippets/PHP
2021. 12. 9. 07:51