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,446
  • 7
  • 45
  • 57

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
  • 43,499
  • 6
  • 78
  • 102
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,097
  • 3
  • 21
  • 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,164
  • 4
  • 45
  • 77