Created
September 30, 2013 08:57
-
-
Save efarem/6761094 to your computer and use it in GitHub Desktop.
Force HTTPS
This file contains 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
if (!isset($_SERVER['HTTPS'])) | |
{ | |
header('Status-Code: 301'); | |
header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); | |
} | |
else | |
{ | |
header('Strict-Transport-Security: max-age=500'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment