title: How to find out if you're using HTTPS without $_SERVER['HTTPS']
body: <p>I've seen many tutorials online that says you need to check <code>$_SERVER['HTTPS']</code> if the server is connection is secured with HTTPS. My problem is that on some of the servers I use, <code>$_SERVER['HTTPS']</code> is an undefined variable that results in an error. Is there another variable I can check that should always be defined?</p>
  
  <p>Just to be clear, I am currently using this code to resolve if it is an HTTPS connection:</p>
  
  <pre><code>if(isset($_SERVER['HTTPS'])) {
      if ($_SERVER['HTTPS'] == "on") {
          $secure_connection = true;
      }
  }
  </code></pre>