【问题标题】:only main Subdomain redirect to main domain through .htaccess只有主子域通过 .htaccess 重定向到主域
【发布时间】:2015-06-03 04:54:52
【问题描述】:

我只想重定向主子域,例如 http://dl.domain.com 到 domain.com

但不将文件或脚本链接重定向到主域。

http://dl.domain.com/123.zip http://dl.domain.com/zippy.zip

如何使用 .htaccess 规则做到这一点?

我使用这些 .htaccess 规则但问题没有解决

RewriteCond %{HTTP_HOST} ^(www\.)?subdomain\.domain\.com$ [NC]
RewriteRule !^xyz\.php($|/) http://www.domain.com%{REQUEST_URI} [NE,R=301,L]

【问题讨论】:

    标签: apache .htaccess subdomain


    【解决方案1】:

    你可以使用:

    RewriteCond %{HTTP_HOST} ^(www\.)?subdomain\.domain\.com$ [NC]
    RewriteRule ^/?$ http://www.domain.com [R=301,L]
    

    【讨论】:

      猜你喜欢
      • 2014-09-29
      • 2011-09-17
      • 2016-12-29
      • 2015-02-13
      • 2013-06-16
      • 1970-01-01
      • 2017-04-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多