Check whether server is http or https Posted on February 17, 2018 by Chandan Sharma in CodeIgniter, PHP# 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:TwitterFacebook Published by Chandan Sharma View all posts by Chandan Sharma