Re: force https
| From: | Jasper Bryant-Greene | Date: | Wed, 29 Jun 2005 04:44:11 +0000 |
| Subject: | Re: force https | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-217797@lists.php.net to get a copy of this message | ||
> Robert Cummings wrote:
>> On Tue, 2005-06-28 at 23:26, Dan Trainor wrote:
>>> <i'm a newbie, you've been warned>
>>>
>>> header('Location: https://mydomain.com'); ?
>>>
>>> </i'm a newbie, you've been warned>
>>>
>>
>> It'll work fine, but here's a something a little more generic :)
>>
>> header( 'Location:
>>
>> https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']«<‰/d¯‘V
>> {o·@= );
>>
>> Cheers, Rob.
That'll work, but if you have the same files serving both the HTTP and
HTTPS sites you might want to enclose it in the following, unless you
like infinite loops:
if($_SERVER['HTTPS'] != 'on') {
}
Assuming that you're using Apache. I'm not sure if other servers set
that variable.
Jasper