【问题标题】:Redirecting / Replacing domain重定向/替换域
【发布时间】:2016-02-12 09:13:53
【问题描述】:

我已将网站从 sub.domain-1.com 移至 https://domain-2.com/blog 保持岗位结构不变。 我想将所有内容重定向到第二个域 这是我已经做过的

RewriteCond %{HTTP_HOST} ^sub.domain-1.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.sub.domain-1.com [NC]
RewriteRule ^(.*)$ https://domain-2.com/blog/$1 [L,R=301,NC]

这适用于主域。 但是因为我有帖子
子域-1。 com/20xx/xx/xx/some-post-or-some-page/

我希望所有帖子都应该重定向到
https://domain-2.com/blog/20xx/xx/xx/some-post-or-some-page/

或者我只是想替换 sub.domain-1 的所有实例。 com/ 与 domain-2.com/blog/

【问题讨论】:

  • 有什么问题?这些规则看起来应该有效

标签: wordpress apache .htaccess redirect dns


【解决方案1】:

在 sub.domain-1/htaccess 中,尝试:

RedirectMatch 301 ^/(.*)$ https://domain-2.com/blog/$1

【讨论】:

    猜你喜欢
    • 2012-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-16
    • 2016-09-23
    • 1970-01-01
    • 2013-03-29
    • 2010-10-22
    相关资源
    最近更新 更多