【问题标题】:Getting subdomain to redirect and follow CNAME让子域重定向并遵循 CNAME
【发布时间】:2018-04-27 23:05:53
【问题描述】:

我已将域从 olddomain.com 迁移到 newdomain.com...我希望所有 URL 从 olddomain.com 重定向到 newdomain.com。我让这部分工作。我现在的问题是我在 newdomain 上有一个用于 help.newdomain.com -> externaldomain.com 的 CNAME(使用 referrerURL 登陆正确的页面) 我需要重定向 help.olddomain.com -> help.newdomain.com -CNAME-> externaldomain.com .htaccess 重写有可能吗?如果没有,还有其他方法可以剥皮吗?

【问题讨论】:

    标签: .htaccess redirect url-rewriting subdomain cname


    【解决方案1】:

    是的,301 .htaccess 重写应该可以做到。把这个放到当前服务help.olddomain.com的服务器中:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^help.olddomain.com [NC]
    RewriteRule ^(.*)$ http://externaldomain.com/$1 [L,R=301,NC]
    

    如果您真的希望它首先点击help.newdomain.com,请改用RewriteRule

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-09
      • 2014-02-25
      • 2011-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-01
      • 2021-04-23
      相关资源
      最近更新 更多