Re: checking for and enforcing https

From: Date: Mon, 25 Feb 2008 19:14:45 +0000
Subject: Re: checking for and enforcing https
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-270109@lists.php.net to get a copy of this message
> Or you can cheat... > > $url = $_SERVER['SERVER_NAME']; > header( 'Location:https://'.$url.''); > > I think that would cause an infinite loop of redirection... This would be better <?php $curPort = $_SERVER['SERVER_PORT']; $pageTo = $_SERVER['REQUEST_URI']; if($curPort == "80") { // go secure header("location:https://www.domain.com$pageTo"); exit; } ?> -- Stephen Johnson c | eh The Lone Coder http://www.thelonecoder.com continuing the struggle against bad code http://www.fortheloveofgeeks.com I¹m a geek and I¹m OK! -- > From: Wolf <lonewolf@nc.rr.com> > Date: Mon, 25 Feb 2008 13:55:41 -0500 > To: Rick Pasotto <rick@niof.net> > Cc: <php-general@lists.php.net> > Subject: Re: [PHP] checking for and enforcing https > > > ---- Rick Pasotto <rick@niof.net> wrote: >> What is the best or recomended proceedure for making sure that a page is >> accessed only via a secure connection? >> > > Make the server only send over 443 instead of 80... > > But if you don't have the ability to change .htaccess or httpd.conf then you > can use the $SERVER variables and make them work that way... > > Wolf > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#270109) next »