views:

356

answers:

1

I have a website with friendly urls.

I want all url´s that end with .htm, .gif, .jpg, .css, .js be served directly by the Apache web server and the rest passed on to Tomcat.

examples of dynamic url´s that should be forwarded to Tomcat:

www.mysite.com/news/newsItem1
www.mysite.com/videos
www.mysite.com/news/list.jsp

examples of static url´s on the same site that should be served by Apache:

www.mysite.com/news/newsItem2.htm
www.mysite.com/image1.gif

Using the jk_module I figured out how to configure JkMount to forward extensions like .jsp to Tomcat... however what I am looking for is a not operator in the url so that I can specify something like: if url not ending with .htm or .gif or .jpg or .css or .js then forward to Tomcat.

Any ideas as to how I can do this?

+3  A: 

Here's an example from the mod_jk documentation:

# All requests go to worker1 by default
JkMount /* worker1
# Serve html, jpg and gif using httpd
JkUnMount /*.html worker1
JkUnMount /*.jpg  worker1
JkUnMount /*.gif  worker1

You can easily generalize it to your needs.

David Zaslavsky
Thanks so much. It is great when answers are simple like this one. You have no idea how much this information helps me.
Kishnan