On 13/06/2012 05:12, Oguz Kologlu wrote:
> You can do this but not in Tomcat itself. You'll need to use something like 
> Apache web server
> to handle different sub domain and direct them to Tomcat.

That's an imprecise & potentially misleading answer.
Please see the other answer in this thread.


p

> If it's only one site running you could use the defaultHost attribute to 
> direct the request when it doesn't find a matching <Host>  element
> 
> Oz
> 
> 
> 
> On 13/06/2012, at 1:58 PM, Albert Kam wrote:
> 
>> I have checked the tuckey urlRewriter, and it seems cool, but doesnt
>> seem to fit my needs.
>> Anyway, you warnings make a lot of sense to me, so thanks there !
>>
>> On Wed, Jun 13, 2012 at 2:29 AM, André Warnier <a...@ice-sa.com> wrote:
>>> 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
>>>
>>
>>
>>
>> -- 
>> Do not pursue the past. Do not lose yourself in the future.
>> The past no longer is. The future has not yet come.
>> Looking deeply at life as it is in the very here and now,
>> the practitioner dwells in stability and freedom.
>> (Thich Nhat Hanh)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


-- 

[key:62590808]

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to