How do I redirect JSP webapps handled by Tomcat to another server/domain?

I am planning a migration from our current server (Sun OS 5.8) to our new server (Redhat 4 64-bit).  I have recreated a similar infrastructure on the new server - Apache2, Tomcat, MySQL, Twiki.

On the current server I am running Apache 2.0.49 and Tomcat 5.0.24
On the new server I am running Apache 2.0.52 and Tomcat 5.5.25
On each machine I am using default ports: port 80 for Apache and 8080 for Tomcat.

All the pieces on the new server are working fine and accessing stuff only in the new environment.

My problem is to seamlessly redirect any links/references to the old domain/server to the new one, for both Apache2 (port 80) and for Tomcat (port 8080).

On the old server, I know I can add a redirect in apache's httpd.conf to redirect all apache
requests (for documents and cgi-bin scripts) to the new server and that seemed to work fine:
AllowOverride All
Redirect permanent /

Tomcat is running and handling all requests sent to
What I need is to also redirect those tomcat webapp requests.  And I just want the simplest, easiest way to do so.  Speed or load is not an issue.
I want all of these type of references to redirect smoothly:
from   to       to

I've searched forums and found lots of suggestions using a variety of techniques,
but have not been successful.  I'm not very familiar with mod_rewrite, mod_jk, 301 redirection, etc. but am learning slowly.
I was also experimenting with Paul Tucke's URLRewriteFilter, but couldn't get that to work
(it would not match any of my "from" expressions).
It seems to me that this shouldn't be that complicated hard, but I'm finding it very confusing and frustrating.  I think I should be able to do it perhaps using mod_rewrite, but I get tangled trying to determine specifically what I need to add to accomplish that.

What would you recommend as the easiest way to get all of these redirections to occur
from an old server in one domain to a new server in another domain?

I've reverted to what was the original conf files for apache and for tomcat (without any of my additions).
When I start up tomcat, I see the following in the catalina.out file:
Nov 17, 2008 3:44:49 AM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Nov 17, 2008 3:44:49 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /
Nov 17, 2008 3:44:49 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/22  config=null

Who is Participating?
caterham_wwwConnect With a Mentor Commented:
> perhaps using mod_rewrite

If is a tomcat application server, you can't use apache's modules here. Or does connect to tomcat?

Did you already try the UrlRewriteFilter with

<name>redirect olddomain</name>
<condition name="host" operator="notequal">myweb\.newdomain\.com:8080</condition>
<to type="redirect">$1</to>

Open in new window

bohunk24Author Commented:
Thank you Caterham!  That was the clue I needed!
I had tried all sorts of permutations on URL rewrite rules.  However, I didn't include any conditions since the documentation led me to believe I didn't need them and that I could do everything in the regular expression of the "from".
Your suggestion worked perfectly for webapps/ROOT.  I did need to modify it slightly for the other subdirectories in webapps.  While I was able to use the same <from> in the urlrewrite.xml, but had to add the directory name to the <to>, e.g. <to type="redirect">$1</to
P.S. In answer to your question, yes, connects to Tomcat.  I don't need apache for that.  
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.