Use Tucky UrlRewriteFilter to hide .jsp at the end of URLs.

I would just hide the .jsp file extension at the end of all my URLs for my Java web application. I already got a Tucky UrlRewriteFilter integrated using Maven, but I can’t understand the magic rule to do what I need.

For instance:

example.com/webapp/home β†’ example.com/webapp/home.jsp

example.com/home β†’ example.com/home.jsp

example.com/blah β†’ example.com/blah.jsp

Does anyone know a trick? I googled, read the docs and tried a few rules with no luck. Thanks!

+2
source share
2 answers

Try the following:

<rule> <from>^/?([az]+)$</from> <to type="forward">/$1.jsp</to> </rule> 

You can optionally redirect from example.com/home.jsp to example.com/home

0
source
 <rule> <from>^/bookmark-new$</from> <to>/bookmark-new.jsp</to> </rule> 
-1
source

All Articles