redirect from root app to app with other context in same host in tomcat

Splash Forums Rewrite Users redirect from root app to app with other context in same host in tomcat

This topic contains 5 replies, has 2 voices, and was last updated by  Serkan Durusoy 9 years, 10 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #18193

    Serkan Durusoy

    Hi Everyone,

    I’m using Tomcat 7 and a couple of JSF2 applications.

    I have one app with context /myapp using JSF2 and prettyfaces with spring (I guess these details are not important in my case)

    I want also to deploy a ROOT app (with context /) in the same host in order to manage inbound requests that are above the /myapp path so that:

    * http://mydomain and http://mydomain/ are redirected to http://mydomain/myapp/

    * http://mydomain/xxxx and http://mydomain/xxxx/ are redirected to http://mydomain/myapp/xxxx

    My questions are as follows:

    1) Should I chose prettyfaces or rewrite for this task

    2) Given the answer to above, what would be the best configuration




    Serkan Durusoy

    Quick update,

    I chose to go with rewrite since it seems to suit the job better.

    Now the question is; what should my configuration look like?

    I tried this as a quick solution:

    public class MyappConfigurationProvider extends HttpConfigurationProvider {

    public int priority() {
    return 10;

    public Configuration getConfiguration(final ServletContext context) {
    return ConfigurationBuilder.begin()

    This seems to work with http://mydomain/xxxx but not with http://mydomain


    You path isn’t correct. Your configuration requires the path to start with a / character. Try something like:

    return ConfigurationBuilder.begin()

    I hope this helps :)



    Serkan Durusoy

    Hi Christian,

    This worked like a charm.

    I need to ask a follow up question:

    * what is the priority? what does 10 mean?


    The priority just allows to create an ordering if there are multiple implementations of HttpConfigurationProvider. If you have just on implementation this value doesn’t matter. :)


    Serkan Durusoy

    Oh, thanks.

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘Rewrite Users’ is closed to new topics and replies.

Comments are closed.