Skip to content

Instantly share code, notes, and snippets.

@johnnypea
Created April 26, 2017 14:43
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 johnnypea/73c25364f22fde36b6750ade1097e665 to your computer and use it in GitHub Desktop.
Save johnnypea/73c25364f22fde36b6750ade1097e665 to your computer and use it in GitHub Desktop.
WordPress wp-config.php customization for multiple domains
<?php
if (isset($_SERVER['HTTP_HOST'])) {
// HTTP is still the default scheme for now.
$scheme = 'http';
// If we have detected that the end use is HTTPS, make sure we pass that
// through here, so <img> tags and the like don't generate mixed-mode
// content warnings.
if (isset($_SERVER['HTTP_USER_AGENT_HTTPS']) && $_SERVER['HTTP_USER_AGENT_HTTPS'] == 'ON') {
$scheme = 'https';
}
define('WP_HOME', $scheme . '://' . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', $scheme . '://' . $_SERVER['HTTP_HOST']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment