简体   繁体   中英

Getting the query string when using Tuckey URL Rewrite

I have the following rule:

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

And I want to match the following url:

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

and redirect it to:

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

The problem is that when the url rewriter engine finds the "?" character in the url it does not return anything else in the $1 matched parameter. Neither it adds the parameters to the query string. Any ideas?

有一种更好的方法,尝试在urlrewrite中添加use-query-string =“ true”

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

Finally I've found a way to solve this:

Rule:

<rule>
     <from>^/users/$</from>
     <to last="true">/users.do?%{query-string}</to>
</rule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM