Skip to content

Instantly share code, notes, and snippets.

@kylestev
Created May 28, 2012 02:08
Show Gist options
  • Save kylestev/2816843 to your computer and use it in GitHub Desktop.
Save kylestev/2816843 to your computer and use it in GitHub Desktop.
HTTP to HTTPS redirection in PHP
<?php
if ($_SERVER['SERVER_PORT'] != 443) {
header(sprintf('Location: https://%s%s', $_SERVER['SERVER_NAME'], $_SERVER['REQUEST_URI']));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment