CodeIgniter / PHPCheck whether server is http or https February 17, 2018 Chandan SharmaComment on Check whether server is http or https# Check whether server is http or https if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) { $uri = 'https://'; } else { $uri = 'http://'; } $uri .= $_SERVER['HTTP_HOST']; echo $uri; Share this:FacebookX