1

我有以下规则:

<rule>
     <from>^/users/(.*)$</from>
     <to last="true">/users.do$1</to>
</rule>

我想匹配以下网址:

http://localhost:8077/users/?elemsPerPage=10

并将其重定向到:

http://localhost:8077/users.do?elemsPerPage=10

问题是当 url 重写器引擎找到“?” url 中的字符它不会在 $1 匹配参数中返回任何其他内容。它也不会将参数添加到查询字符串中。有任何想法吗?

4

2 回答 2

7

最后我找到了解决这个问题的方法:

规则:

<rule>
     <from>^/users/$</from>
     <to last="true">/users.do?%{query-string}</to>
</rule>
于 2012-02-21T09:40:06.020 回答
7

有更好的办法,尝试在urlrewrite中添加use-query-string="true"

<urlrewrite use-query-string="true">

于 2013-08-28T12:49:20.407 回答