Apche, tomcat and redirect form domain to subdir. - Debian

This is a discussion on Apche, tomcat and redirect form domain to subdir. - Debian ; Hello list, Background: My siet is at a.com I've got three new domains, lets say b.com, c.com,... All domains point to one ip. At this IP i have a apache and behind it a tomcat with mod_jk. Until now there ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Apche, tomcat and redirect form domain to subdir.

  1. Apche, tomcat and redirect form domain to subdir.

    Hello list,

    Background:
    My siet is at a.com
    I've got three new domains, lets say b.com, c.com,...
    All domains point to one ip. At this IP i have a apache and behind it
    a tomcat with mod_jk.

    Until now there was a website with a few categories (let say a,b,...)
    in subdirectories. (named /a, /b, /c,...).
    This site is a hihgly complex by now. (Session, redirects, multi
    language, some shared directories for content and images,etc.)

    Know the new twist:
    the domain a.com should be redirected to the subdirectory /a, b.com to
    dir /b, and so on, but the url in the browser should remain b.com.

    How can i do this?


    Until now i tried:

    mod_rewrite: Works fine with only static content.

    RewriteCond %{HTTP_HOST} ^b.com [NC]
    RewriteCond %{REQUEST_URI} !^/common/
    RewriteCond %{REQUEST_URI} !^/b/
    RewriteRule ^/(.*) http://a.com/b/$1 [P,L]

    and so on for the other domains.

    But if a jsp page does a redirect, the hostname ist replaced by a.com,
    even if the browser said b.com. This is because tomcat didnt know
    about the host part of the url, i belive and build the url from the
    information it got in server.xml which says "a.com", (b.com, c.com,...
    are aliases in server.xml).

    Problem:
    And therefore the session ist lost for all following requests, and the
    user is logged out.

    Question:
    How can i preserver a session through apache rewriting?

    I also tinkerd with reverse proxying:
    only works for redirecting subdirs to domains, the other way round for
    my problem.

    Any advice?


    Thanks in advance...

    Andreas

  2. Re: Apche, tomcat and redirect form domain to subdir.

    Hello Andreas,

    I don't work with jsp or servlets, I'm just admin of apache &
    tomcat. My suggestion is:


    ServerName www.b.com
    JkMount / something


    That something should be the same as for a.com (your primary
    domain), tomcat configuration also the same.

    Now the main point is on your servlet application in determining the
    URL - it should use something like REQUEST_URI variable and make
    redirections based on this.

    Thursday, September 15, 2005, 18:27:49, Andreas Rabus wrote:

    AR> Know the new twist:
    AR> the domain a.com should be redirected to the subdirectory /a, b.com to
    AR> dir /b, and so on, but the url in the browser should remain b.com.

    AR> How can i do this?

    --
    bYE, Marki


    --
    To UNSUBSCRIBE, email to debian-isp-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

+ Reply to Thread