我有一个wp安装example.com
并且想要secondary.com
显示的内容example.com/b
(b是一页)但保留secondary.com
在url中(非secondary.com/b)
我尝试了这种方法:https://stackoverflow.com/a/35272993/2095642
我将两个域都指向一个目录,我在wp-config.php:
//this works, enables both domains to show the same wp installation
define(\'WP_SITEURL\', \'http://\' . $_SERVER[\'HTTP_HOST\']);
define(\'WP_HOME\', \'http://\' . $_SERVER[\'HTTP_HOST\']);
这是我的。htaccess:
#this works, changes example.com/b url to secondary.com
RewriteCond %{HTTP_HOST} example.com$
RewriteRule ^b/(.*)$ https://www.secondary.com/$1 [L,QSA,R=302]
#this doesn\'t take effect and shows homepage on secondary.com
#I want it to keep only secondary.com in URL but show page /b/.
RewriteCond %{HTTP_HOST} secondary.com/?$
RewriteRule ^$ /b/ [L,QSA]
第二条规则在指向非wp目录时正常工作-保留url但显示目录的索引。但当指向wp页面路径时,它不会。
谢谢