Display same site from two domains on a multisite install

I need to have two domains show the same WordPress blog along with the same content on my multisite install.The main blo

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

相关推荐

  • Display same site from two domains on a multisite install

    I need to have two domains show the same WordPress blog along with the same content on my multisite install.The main blo

    20小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信