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
Reply to: