Skip to content

Instantly share code, notes, and snippets.

@ennjoy
Last active June 8, 2019 07:19
Show Gist options
  • Save ennjoy/8fea5f834e344c655f7009fc40801d88 to your computer and use it in GitHub Desktop.
Save ennjoy/8fea5f834e344c655f7009fc40801d88 to your computer and use it in GitHub Desktop.
code
$server_scheme = @$_SERVER["HTTPS"];
$pageURL = ($server_scheme == "on") ? "https://" : "http://";
$http_url = $pageURL . $_SERVER['HTTP_HOST'];
$url = parse_url($wo['config']['site_url']);
if (!empty($url)) {
if ($url['scheme'] == 'http') {
if ($http_url != 'http://' . $url['host']) {
header('Location: ' . $wo['config']['site_url']);
exit();
}
} else {
if ($http_url != 'https://' . $url['host']) {
header('Location: ' . $wo['config']['site_url']);
exit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment