【问题标题】:ModRewrite redirect dynamic sub-domainsMod_Rewrite 重定向动态子域
【发布时间】:2011-03-30 04:56:16
【问题描述】:

我正在努力实现以下目标:

当用户尝试访问“user1.domain.com”时

我想重定向到:“user1.anotherdomain.com”

我试过这条规则,但没用

RewriteRule ^(.*).domain.com$ $1.anotherdomain.com [R=301,NC]

非常感谢任何帮助!

【问题讨论】:

    标签: mod-rewrite


    【解决方案1】:

    听起来应该可以:

    RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com$ [NC]
    RewriteRule ^/(.*)$ http://%1.anotherdomain.com/$1 [R=301]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-14
      • 2010-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-09
      • 1970-01-01
      相关资源
      最近更新 更多