【发布时间】:2011-01-19 21:00:38
【问题描述】:
我目前正在将 domain.com/a/123/abc 改写为 page.php?this=123&that=abc :
RewriteRule ^a/([^/]+)/([^/]+)/?$ page.php?this=$1&that=$2 [L]
此外,我现在想将 a.domain.com/123/abc 修改为 page.php?this=123&that=abc
所以a.domain.com/123/abc 和domain.com/a/123/abc 都会重定向到page.php?this=123&that=abc
我的问题是匹配子域和查询字符串。这是我一直在做的,但仍然没有正确重写。
RewriteCond %{HTTP_HOST} ^a\.domain\.com/ [NC]
RewriteCond %{QUERY_STRING} /([^/]+)/([^/]+)/?$ [NC]
RewriteRule ^(.*) /a/$1/$2 [L]
请注意,已设置通配符域 (*.domain.com)。只是 htaccess mod_rewriting 失败了。
【问题讨论】: