Re: Can PHP do this...?

From: Date: Wed, 11 Dec 2002 18:40:45 +0000
Subject: Re: Can PHP do this...?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127868@lists.php.net to get a copy of this message
> 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>"; > } else { > echo "**Rest of Page**"; > } > > Would this work? I am about to add a secind site to my site using an alias > in Apache. Example is http://www.mysite.com for first site and > http://www.mysite.com/2ndsite. Except I want everything for the > second site > to be https. Make sense? if(!isset($_SERVER['HTTPS'])) { header("Location: https://www.mysite.com/2ndsite"); } That should work. Or you could echo the META redirect if you wanted to display a page, but this should do it transparently. There is probably a way to do it with just Apache, too, that wouldn't involve PHP. ---John Holmes...

« previous php.general (#127868) next »