Re: Can PHP do this...?
| From: | @ Edwin | Date: | Thu, 12 Dec 2002 16:47:09 +0000 |
| Subject: | Re: Can PHP do this...? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128036@lists.php.net to get a copy of this message | ||
Hello,
"1LT John W. Holmes" <holmes072000@charter.net> wrote:
> > 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.
I think there's some useful info here (about doing it with "just Apache"):
http://httpd.apache.org/docs-2.0/ssl/ssl_howto.html
Just in case...
- E