我正在apache tomcat5.5上使用一个带有spring Framework2.0的J2ee应用程序。
我已经使用URL映射将扩展名从.jsp更改为.htm。我有一个网址,看起来像这个localhost:8080/promotion.htm?cid=12345。
我想把它改成localhost:8080/12345
有没有人可以帮我写一条规则,使用tuckey URL重写过滤器在urlrewrite.xml中执行所需的重写
这就是我在web.xml中提到的内容
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewrite Filter</filter-class> </filter>我所需要的就是更改为http://localhost:8080/12345的网址。我不希望发生任何重定向。所有我需要的是一个干净的网址,使网址看起来整洁。我自己尝试了相当多的规则,但都没有成功。
如何做到这一点?
发布于 2011-04-08 17:32:32
在很长一段时间没有回复/评论之后,我自己用urlrewrite.xml中的以下规则实现了这一点
<rule>
<from>/([a-zA-Z0-9]{1,}$)</from>
<to >/promotion.htm?cid=$1</to>
</rule>发布于 2011-04-17 01:04:16
更多信息请点击此处:
http://www.tuckey.org/urlrewrite/manual/3.0/
https://stackoverflow.com/questions/5067405
复制相似问题