RE: [PHP] Redirect to HTTPS
| From: | Luis Lebron | Date: | Fri, 01 Aug 2003 21:37:25 +0000 |
| Subject: | RE: [PHP] Redirect to HTTPS | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-158007@lists.php.net to get a copy of this message | ||
Here's another way to do it:
<?php
$url=$_SERVER["SCRIPT_URI"];
$url_array=parse_url($url);
if($url_array["scheme"]!="https")
{
header("Location: https://$url_array[host]$url_array[path]");
}
?>
Luis
-----Original Message-----
From: Richard Baskett [mailto:php@baskettcase.com]
Sent: Friday, August 01, 2003 3:25 AM
To: PHP General
Subject: Re: [PHP] Redirect to HTTPS
This is how I do it:
if ($_SERVER['HTTPS']!='on') {
header("Location: https://mynet.com/pay.php");
exit;
}
"It is my ambition to say in ten sentences; what others say in a whole
book." - Friedrich Nietzsche
> From: desa15@necso.es
> Date: Fri, 1 Aug 2003 10:20:58 +0200
> To: php-general@lists.php.net
> Subject: [PHP] Redirect to HTTPS
>
> I have a stupid question.
>
> I need if i be in a http make a redirect to https.
> Http is a 80 port and ssl is a 443 port
>
> if ($HTTP_SERVER_VARS['SERVER_PORT']==80)
> {
>
> header("Location: https://mynet.com/pay.php");
> exit;
> }
>
> Is the correct way to do this ??? Exist any function to make this ???
>
>
>
> Excuse my broken English, Regards from Spain
>
> Un saludo, Danny
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php