note 69959 added to function.getenv

From: Date: Wed, 27 Sep 2006 21:34:41 +0000
Subject: note 69959 added to function.getenv
Groups: php.notes 
Request: Send a blank email to php-notes+get-117755@lists.php.net to get a copy of this message
This came in really handy, I looked everywhere on the Internet for a simple answer to this and the solution turned out to be pleasantly simple. Let's say you have a secure server. You want everyone to use this secure server every time they access. But, you don't want to cut off http access entirely because people do forget to type that in the address bar. Just stick this at the top of your PHP script or in your header file: if (!$_SERVER["HTTPS"]) { header("Location: https://your.secure.server.com/\n\n"); exit; } I am testing this now but so far it works great, how would all of you all normally handle this (without forcing .htaccess passwords and doing the redirect that way, just for general users)? I tried web searches along the lines of "apache http https in different directories" and "force https access redirect apache" but nothing really worked as simply as this did. ---- Server IP: 64.71.164.2 Probable Submitter: 66.189.127.193 ---- Manual Page -- http://www.php.net/manual/en/function.getenv.php Edit -- https://master.php.net/note/edit/69959 Del: integrated -- https://master.php.net/note/delete/69959/integrated Del: useless -- https://master.php.net/note/delete/69959/useless Del: bad code -- https://master.php.net/note/delete/69959/bad+code Del: spam -- https://master.php.net/note/delete/69959/spam Del: non-english -- https://master.php.net/note/delete/69959/non-english Del: in docs -- https://master.php.net/note/delete/69959/in+docs Del: other reasons-- https://master.php.net/note/delete/69959 Reject -- https://master.php.net/note/reject/69959 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117755) next »