Skip to content

Instantly share code, notes, and snippets.

Created June 6, 2011 16:28
Show Gist options
  • Save anonymous/1010583 to your computer and use it in GitHub Desktop.
Save anonymous/1010583 to your computer and use it in GitHub Desktop.
if (!strcasecmp(substr($_SERVER['REQUEST_URI'],0,5),'/user') && !isset($_SERVER['HTTPS'])) {
header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit();
}
if (strcasecmp(substr($_SERVER['REQUEST_URI'],0,5),'/user') && isset($_SERVER['HTTPS'])) {
header("Location: http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit();
}
if (!strcasecmp(substr($_SERVER['REQUEST_URI'],0,5),'/user')) {
$protocol = "https";
}
else {
$protocol = "http";
}
$base_url = $protocol . "://testsite.com";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment