【发布时间】:2010-09-08 03:34:18
【问题描述】:
我正在尝试将通配符域的请求重定向到子目录。
IE。 something.blah.example.com --> blah.example.com/something
我不知道如何获取子域名以在重写规则中使用。
最终解决方案:
RewriteCond %{HTTP_HOST} !^blah\.example\.com
RewriteCond %{HTTP_HOST} ^([^.]+)
RewriteRule ^(.*) /%1/$1 [L]
或者正如 pilif 指出的那样
RewriteCond %{HTTP_HOST} ^([^.]+)\.blah\.example\.com$
【问题讨论】:
标签: apache redirect mod-rewrite subdomain wildcard-subdomain