Albert Kam wrote:
Dear Tomcat Users !

Let's say that i have this simple webapp using Tomcat 7, and let's say
the context name is "albertzoo"
http://albertzoo.com

"albertzoo" is not the context here, it's a <Host>.
If you want that application to respond to the URL "http://albertzoo.com/"; (thus the context "/"), you will have to use the ROOT webapp.


And then, i would like a niche site for monkeys with it's own domain :
http://albertzoomonkeys.com

"albertzoomonkeys.com" is the host. The context is "/".

which is actually the same as :
http://albertzoo.com/monkeys

In this one (barring tricks), "monkeys" is the context.


But if the user is accessing through albertzoomonkeys.com, i dont want
them to see the albertzoo.com/monkeys in their browser

unless you do an external redirect, they should not see that.


Is it possible to do with a single webapp context, or do i have to
have different contexts(virtual hosts) for these different domains ?


I think that technically, you could monkey around to achieve that. But it is probably a lot more trouble than it's worth (risks of double deployment, a mess when you undeploy or want to manage your apps etc..).

Probably much better to use two separate <Host>, each with its own appBase (/webapps) directory; in one of them, you deploy your application as the ROOT (default) application (see the FAQ for that); in the other, you deploy *a copy* of the same application as "monkeys" (and, supposedly, some other "animals" application as ROOT). The only inconvenient is that when you update the monkeys application, you'll have to copy it to both places. But that will be much easier to manage, than to try some clever overlapping scheme which is going to come back and hit you somewhere..

Alternatively, if you feel adventurous, you could try a single <Host> with an Alias, and play with the URLrewrite filter (see www.tuckey.org) and internal redirects, but... you have been warned.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to