0
我目前mod_rewriting domain.com/a/123/abc
匹配page.php?this=123&that=abc
有:mod_rewrite的两个子域和查询字符串
RewriteRule ^a/([^/]+)/([^/]+)/?$ page.php?this=$1&that=$2 [L]
此外,我现在要mod_rewrite的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。
没有,但删除它并没有区别 – Peter 2011-01-20 10:48:06