Skip to content

Instantly share code, notes, and snippets.

@iandundas
Created May 20, 2013 04:44
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 iandundas/5610473 to your computer and use it in GitHub Desktop.
Save iandundas/5610473 to your computer and use it in GitHub Desktop.
Force HTTPS
<?php
if(empty($_SERVER['HTTPS']))
{
// If not, redirect
$newurl = 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
header("location: $newurl");
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment