【问题标题】:.htaccess rewrite all subdomains to root.htaccess 将所有子域重写为 root
【发布时间】:2012-08-10 01:09:42
【问题描述】:

这可能在其他地方被问到,但无法真正找到答案。

我想使用 htaccess 将所有子域 (*.domain.com) 重定向到根 (即 domain.com)。简而言之:

test.domain.com -> domain.com
asdasdasd.domain.com -> domain.com
etc.

谢谢!

【问题讨论】:

    标签: .htaccess rewrite


    【解决方案1】:

    试试下面的,应该可以的

    RewriteCond %{HTTP_HOST} ([^.]+)\.domain.com [NC]
    RewriteRule ^(.*) http://domain.com/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-25
      • 1970-01-01
      • 2019-12-21
      • 1970-01-01
      • 2011-05-15
      • 2011-02-04
      • 2014-03-17
      相关资源
      最近更新 更多