【问题标题】:How can I redirect main domain to another domain but not include sub domains in the redirect - htaccess如何将主域重定向到另一个域但在重定向中不包含子域 - htaccess
【发布时间】:2012-04-19 22:27:16
【问题描述】:

我的域有 .co.uk 和 .com,我目前有 .co.uk 设置以重定向到 .com。虽然这可行,但我现在需要稍微改进此重定向,使其不包含任何子域。所以 www.domainname.co.uk 将重定向到另一个,但 subdomain.domainname.co.uk 不会重定向。

这可能吗?如果可以,我该怎么做?

【问题讨论】:

    标签: html linux .htaccess hosting


    【解决方案1】:

    你可能想看看RewriteCond,像这样:

    RewriteCond %{HTTP_HOST} www.\mysite\.co\.uk [NC]
    RewriteRule (.*) http://www.mysite.com/$1 [R=301]
    

    有关RewriteCond的更多详细信息:http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond

    【讨论】:

      猜你喜欢
      • 2016-03-26
      • 1970-01-01
      • 1970-01-01
      • 2020-05-04
      • 2014-03-16
      • 2021-04-16
      • 2011-08-27
      • 1970-01-01
      相关资源
      最近更新 更多