title: Using protocol-relative URIs within "Location:" headers
body: <p>I note in the <a href="http://php.net/manual/en/function.header.php" rel="noreferrer">PHP manual</a> which states the following:</p>
  
  <blockquote>
    <p>HTTP/1.1 requires an absolute URI as argument to » Location: including
    the scheme, hostname and absolute path, but some clients accept
    relative URIs.</p>
  </blockquote>
  
  <p>To facilitate users with preference for a <a href="https://www.eff.org/https-everywhere" rel="noreferrer">HTTPS everywhere</a> connection, I am thinking of changing the headers in my PHP scripts from:</p>
  
  <p><code>header("Location: http://www.example.com/");</code> to <code>header("Location: //www.example.com/");</code></p>
  
  <p>I have tested the above code to be working on my firefox browser, but I am not sure whether it is an advisable thing to do. Or whether I should extract the protocol from <code>$_SERVER</code> variable and put it in.</p>