Skip to content

Instantly share code, notes, and snippets.

@pedrovasconcellos
Created September 25, 2019 03:49
Show Gist options
  • Save pedrovasconcellos/7fb031994b5ee6ec0f0370cf8179e8f3 to your computer and use it in GitHub Desktop.
Save pedrovasconcellos/7fb031994b5ee6ec0f0370cf8179e8f3 to your computer and use it in GitHub Desktop.
HTTPS Redirect
<?php
if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off"){
$redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $redirect);
exit();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment