Skip to content

Instantly share code, notes, and snippets.

@bramus
Created December 4, 2013 11:12
Show Gist options
  • Select an option

  • Save bramus/7785923 to your computer and use it in GitHub Desktop.

Select an option

Save bramus/7785923 to your computer and use it in GitHub Desktop.
Enforce HTTPS
<?php
if ((((int) $_SERVER['SERVER_PORT']) !== 443) && (!isset($_SERVER['HTTPS']) || ($_SERVER['HTTPS'] == 'off'))) {
header("HTTP/1.1 301 Moved Permanently");
header('location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
exit();
}
?>
<h1>Welkom op de https versie!</h1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment