Created
May 20, 2013 04:44
-
-
Save iandundas/5610473 to your computer and use it in GitHub Desktop.
Force HTTPS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(empty($_SERVER['HTTPS'])) | |
{ | |
// If not, redirect | |
$newurl = 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; | |
header("location: $newurl"); | |
exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment