10

I'll build a web application and I want to use url rewriting. In apache this is done with mod_rewrite. But how can I rewrite urls with Tomcat 6?

I want to use Struts 2 framework.

Enrique
  • 9,920
  • 7
  • 47
  • 59

3 Answers3

14

I've used UrlRewriteFilter as a critical component of a couple of my tomcat-based apps, and have been totally happy with it.

Jonathan Feinberg
  • 44,698
  • 7
  • 80
  • 103
1

You can do wildcard mappings in your struts.xml:

<action name="*Crud" class="example.Crud" method="{1}">
...

Then I think you can set your default action extension to / in struts.properties:

struts.action.extension=/

As for the URL filter, here's a good blog post.

Droo
  • 3,177
  • 4
  • 22
  • 26
1

It could be a good idea to have Apache as a web server for static content in front of Tomcat application server.

You can then use Apache's mod_rewrite and Tomcat.

In any case, there's a similar question.

Community
  • 1
  • 1
fglez
  • 8,422
  • 4
  • 47
  • 78