RE: [PHP] Can PHP do this...?

From: Date: Wed, 11 Dec 2002 18:54:57 +0000
Subject: RE: [PHP] Can PHP do this...?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127871@lists.php.net to get a copy of this message
>John, PHP-general, > >OK. I think I understand this, but let me ask just to be sure. > >So if I setup in my page something to this effect: >if ($_SERVER['!HTTPS']) { > echo "Switching over to SSL..."; > echo "<META redirect to SSL>"; yuck recommend insuring this is at the top of your page and using header() instead appears seamless to the client > } else { > echo "**Rest of Page**"; > } and would eliminate that as well -----------------------------Start of file------------------------------ <?PHP if ($_SERVER['HTTPS']!='on') { header("Location: https://www.example.com/page.ext"); exit; } # rest of page here since if it isn't secure the page stops at the exit after the header has been sent to the browser to redirect. ?> -----------------------------end of file------------------------------ Check your particular server response for the match, you may be able to just do; if (!$_SERVER['HTTPS']) { Cheers, Dave

« previous php.general (#127871) next »