Re: Making sure page is always https
| From: | Ricky Dhatt | Date: | Mon, 17 Jun 2002 21:09:54 +0000 |
| Subject: | Re: Making sure page is always https | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-102605@lists.php.net to get a copy of this message | ||
try something like this at the top of the PHP script:
if (!_$SERVER['HTTPS']) {
header("Location: https://" . $_SERVER[HTTP_HOST] .
$_SERVER['REQUEST_URI']);
exit;
}
On older versions of PHP you might need to use $HTTP_SERVER_VARS instead of
_$SERVER.
Alternatively, if you are using Apache, I bet you can use mod_rewrite to do
something similar.
Ricky
"Ben C." <benc@cox.net> wrote in message
news:NFBBJJIAAGFCPNFKMPGOAEKCDBAA.benc@cox.net...
> I have a site which I want to make sure is always being view via SSL.
> Currently I have the http://sslsafeserver/index.php page
> redirecting to
> https://sslsafeserver.com/home.php. Is there a way to have all
> pages
viewed
> in SSL through a PHP script?
>
> I appreciate the help.
>
> Ben
>