You are here: Re: [PHP] force https « PHP « IT news, forums, messages
Re: [PHP] force https

Posted by Jasper Bryant-Greene on 06/29/05 07:44

> 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'] );
>>
>> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация