我想将完整的网址(包括QUERY_STRING)重写为index.php?url=[url]&query=[query]
。以下规则适用于: RewriteRule ^(.*)$ index.php?url=$1&query=%{QUERY_STRING} [B]
。 B
标志确保编码为$1
部分,但不编码%{QUERY_STRING}
。我怎样才能编码呢?.htaccess encode%{QUERY_STRING}
实施例:
http://www.website.com/test&test.php?arg1=val1&arg2=val2
重写到Array('url' => 'test&test.php','query' => 'arg1=val1', 'arg2' => 'val2')
,其中Array('url' => 'test&test.php','query' => 'arg1=val1&arg2=val2')
预计。
为什么不从PHP获取'query string'并使用[parse_str](http://php.net/manual/en/function.parse-str.php)创建数组? – machineaddict