forwarding all http to https
Moderator: General Moderators
forwarding all http to https
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?)
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']);- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
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']);