【问题标题】:.htaccess redirect subdomain to custom URL.htaccess 将子域重定向到自定义 URL
【发布时间】:2014-04-11 22:16:09
【问题描述】:

我实际上想将 name.domain.com 重定向到 domain.com/user/name。所以编码 .htaccess 如下

RewriteCond %{HTTP_HOST} ^(.+).domain.com
RewriteRule ^(.*)% http://domain.com/user/%1 [R,L]

但是,我收到 404 错误。您能建议我正确编码 .htaccess 吗?

谢谢。

【问题讨论】:

    标签: .htaccess http-status-code-404


    【解决方案1】:

    试试这个规则:

    RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ [NC]
    RewriteRule ^ http://domain.com/user%{REQUEST_URI} [R,L,NE]
    

    【讨论】:

      猜你喜欢
      • 2018-04-16
      • 2015-12-16
      • 2012-12-08
      • 1970-01-01
      • 1970-01-01
      • 2012-06-01
      • 2012-03-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多