forwarding all http to https
Posted: Tue Jul 18, 2006 10:34 am
This is kind of a stupid question, because I know how to do it I think, but how would you forward all traffic from http to https? (is there a better way than strpos?)
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
if(empty($_SERVER['HTTPS']) || strpos(strtolower($_SERVER['HTTP_HOST']), "www") === false)
header('Location: https://www.silversteepsecure.com' . $_SERVER['REQUEST_URI']);try it yet?The Ninja Space Goat wrote:so I want to make sure that the user is going to https://www.silversteepsecure.com (hot http://silversteepsecure.com or https://silversteepsecure.com or http://silversteepsecure.com). So would this be correct?Code: Select all
if(empty($_SERVER['HTTPS']) || strpos(strtolower($_SERVER['HTTP_HOST']), "www") === false) header('Location: https://www.silversteepsecure.com' . $_SERVER['REQUEST_URI']);