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