Skip to content

Instantly share code, notes, and snippets.

@efarem
Created September 30, 2013 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efarem/6761094 to your computer and use it in GitHub Desktop.
Save efarem/6761094 to your computer and use it in GitHub Desktop.
Force HTTPS
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