title: How to get rid of PHP Notice: Undefined index: HTTPS in X on line 123
body: <p>I just discovered that I have thousands of these errors, coming from two of the same files.</p>
  
  <p>I have removed a lot of errors by using the <code>isset</code>, but I can´t figure out how to remove the last two errors. Maybe you guys can help me.</p>
  
  <pre><code>PHP Notice:  Undefined index: HTTPS on /xxx/xxx/xxx.php on line 123
  </code></pre>
  
  <p>Code from the first PHP file that generates the error:</p>
  
  <pre><code>function curPageURL() {
  $pageURL = 'http';
  if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
  $pageURL .= "://";
  if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  }
  return $pageURL;
  }
  </code></pre>
  
  <p>More exactly this line:</p>
  
  <pre><code>if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
  </code></pre>
  
  <p>And</p>
  
  <pre><code>if (isset($tag)) {
  $tag = htmlspecialchars($_REQUEST['tag'], ENT_QUOTES);
  }
  </code></pre>