Created
February 27, 2015 13:57
-
-
Save madssj/142e5bcb714f9e162ae0 to your computer and use it in GitHub Desktop.
A fix for running a wordpress with a new url, setting WP_HOME and WP_SITEURL to whatever is in $_SERVER['HTTP_HOST']
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Automaticly set the correct WP_HOME and WP_SITEURL based on HTTP_HOST */ | |
$absolute_url = "http" . ($_SERVER['HTTPS'] ? 's' : '') . "://{$_SERVER['HTTP_HOST']}"; | |
if ($_SERVER['HTTP_PORT'] != 80 || $_SERVER['HTTP_PORT'] != 443) { | |
$absolute_url .= "{$_SERVER['HTTP_PORT']}"; | |
} | |
define('WP_HOME', $absolute_url); | |
define('WP_SITEURL', $absolute_url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment