UrlRewriteFilter:删除参数 [英] UrlRewriteFilter: remove parameters

查看:46
本文介绍了UrlRewriteFilter:删除参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 URL,例如 example.com/sample.html?h=22&w=23

I have a URL like example.com/sample.html?h=22&w=23

如何使用 UrlRewriteFilter 删除此 URL 中的参数并使用 URL example.com/sample.html 重定向请求?我需要删除参数,因为我的应用程序(托管在 Tomcat 上)无法处理这些.

How can use UrlRewriteFilter to remove the params from this URL and redirect the request with the URL example.com/sample.html? I need to remove the params because my application (hosted on Tomcat) does not handle these.

推荐答案

<urlrewrite>
    <rule>
        <note>Forward calls from sample.html to sample.html with no query_string</note>
        <from>^/sample.html$</from>
        <to type="redirect" last="true">/sample.html</to>
    </rule>
<urlrewrite>

您可能想要使用转发而不是重定向,这取决于我们的情况.

you might want to use forward rather than redirect, depends on our circumstances.

这篇关于UrlRewriteFilter:删除参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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