admin管理员组文章数量:1022834
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);
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);
本文标签: Display same site from two domains on a multisite install
版权声明:本文标题:Display same site from two domains on a multisite install 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745518147a2154179.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论