Undefined index erreur à l'aide de la variable $_SERVER['HTTPS']

Debug est à jeter...

Notice: Undefined index: HTTPS
C:\xampplite\htdocs\testsite\wp-content\themes\mytheme\header.php
sur la ligne 4

Comment puis-je modifier ma fonction ci-dessous pour éviter l'erreur?

function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 }

Serait-ce équivalent?

if ( isset( $_SERVER["HTTPS"] )) {$pageURL .= "s";}

OriginalL'auteur Scott B | 2011-02-06