I need to have two domains show the same WordPress blog along with the same content on my multisite install.
The main blog's domain is example/blog, and I need to have example.ca/blog showing all the content that appears on example/blog.
I've added an A record in my cloudflare on the example.ca domain pointing to the ip of the example/blog, along with the code below to my wp-config.php, but it's not working.
$hostname = $_SERVER['HTTP_HOST'];
if(!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$hostname = $_SERVER['HTTP_X_FORWARDED_HOST'];
}
$hostname = rtrim($hostname, '/');
$allowed = ['example', 'example.ca'];
if (!in_array($hostname, $allowed)) {
$hostname = 'wpengine';
}
$protocol = (!empty($_SERVER['HTTPS']) || !empty($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
? 'https://'
: 'http://';
$siteUrl = $protocol . $hostname;
define('WP_HOME', $siteUrl);
define('WP_SITEURL', $siteUrl);
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745518148a4631124.html
评论列表(0条)