I am hoping this is an easy question. I am not well versed in Java, I am a ITSM admin, but the ITSM product we use comes with Tomcat as it's web server. I am trying to find out if there is a simple way to set index file (welcome page) of a tomcat site to check for the requestURL() and redirect to certain URL's based on the requestURL().

Long story short I am trying to setup my site like this:

(my tomact server is setup to receive requests on two different hostnames)

If end users reaches my page by going to http://myspecificURL1 then redirect to http://myspecificURL1/mycontext


if end user reached my page by going to http://myspecificURL2 then redirect to http://myspecificURL2/specificlandingpage

I searched for conditional redirects before posting this, but none really addressed what I am trying to do. If anyone can shed some light or kindly point me in the right direction, I may be able save what hair I haven't pulled out yet.


in order to redirect in jsp you can use the following code


Here redirectURL is the url, you need to forward

please find the following link for the complete example

JSP Redirect Example