views:

50

answers:

1

I'm trying to get my Tomcat to use pretty URLs, similar to Apache's MultiViews option. I tried using AJP to proxy Tomcat to Apache, but the .htaccess file is still ignored. What are my options for Tomcat?

A: 

Use a Filter. Let it listen on /* and redirect any unfriendly URL to an friendly URL and forward any friendly URL to an unfriendly URL. A good opensource example is Tuckey's UrlRewriteFilter which behaves almost exactly like Apache's mod_rewrite.

If this concerns a brand new webapplication which is yet to be developed, then a better way is to adopt a MVC framework which supports RESTFul URL's, like Spring MVC. Or maybe homegrow a front controller servlet which makes use of HttpServletRequest#getPathInfo() to determine the pathinfo.

BalusC