使用Tuckey URL Rewrite时获取查询字符串 [英] Getting the query string when using Tuckey URL Rewrite

查看:165
本文介绍了使用Tuckey URL Rewrite时获取查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下规则:

<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中的字符在$ 1匹配参数中不返回任何其他内容。它既不会将参数添加到查询字符串中。任何想法?

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?

推荐答案

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

Finally I've found a way to solve this:

规则:

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

这篇关于使用Tuckey URL Rewrite时获取查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆