Skip to content

Instantly share code, notes, and snippets.

@ltitus210
Created April 30, 2018 15:16
Show Gist options
  • Save ltitus210/7a2314c27aad864810a3988b05697627 to your computer and use it in GitHub Desktop.
Save ltitus210/7a2314c27aad864810a3988b05697627 to your computer and use it in GitHub Desktop.
Support http and https concurrently in wp-config
# Support http and https concurrently
function isSecure() {
return
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| $_SERVER['SERVER_PORT'] == 443;
}
$web_site = $_SERVER['HTTP_HOST'];
$schema = isSecure() ? 'https://' : 'http://';
$web_site_url = $schema . $web_site;
define('WP_HOME', $web_site_url);
define('WP_SITEURL', $web_site_url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment