使用Tucky UrlRewriteFilter隐藏URL末尾的.jsp [英] Use Tucky UrlRewriteFilter to hide .jsp at the end of urls
问题描述
我想在Java Web应用程序所有URL的末尾简单隐藏.jsp文件扩展名.我已经使用Maven集成了Tucky UrlRewriteFilter,但是我无法弄清楚执行所需操作的不可思议的规则.
I would like to simple hide the .jsp file extension at the end of all my urls for my Java web app. I've already gotten Tucky UrlRewriteFilter integrated using Maven, but I cannot figure out the magic rule to do what I need.
例如:
example.com/webapp/home-> example.com/webapp/home.jsp
example.com/webapp/home --> example.com/webapp/home.jsp
example.com/home-> example.com/home.jsp
example.com/home --> example.com/home.jsp
example.com/blah-> example.com/blah.jsp
example.com/blah --> example.com/blah.jsp
有人知道这个窍门吗?我已经用Google搜索,阅读了文档,并尝试了几条没有运气的规则.谢谢!
Does anyone know the trick? I've googled, read the docs, and tried several rules without luck. Thanks!
推荐答案
尝试一下:
<rule>
<from>^/?([a-z]+)$</from>
<to type="forward">/$1.jsp</to>
</rule>
您可以从example.com/home.jsp中将其他制作重定向到example.com/home
You canl additional make redirect from example.com/home.jsp to the example.com/home
这篇关于使用Tucky UrlRewriteFilter隐藏URL末尾的.jsp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!