Skip to content

Instantly share code, notes, and snippets.

@johnsiwicki
Created April 13, 2016 12:46
Show Gist options
  • Select an option

  • Save johnsiwicki/1d07acbea2115a5850651a4c4c8210bc to your computer and use it in GitHub Desktop.

Select an option

Save johnsiwicki/1d07acbea2115a5850651a4c4c8210bc to your computer and use it in GitHub Desktop.
https to http
<?php
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) and $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'http') {
$url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $url");
die();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment