you can let Apache handle those details
http://httpd.apache.org/docs/2.0/vhosts/examples.html
//supply your own IP and Port
Listen 80
# This is the "main" server running on 172.20.30.40
ServerName server.domain.com
DocumentRoot /www/mainserver
# This is the other address
NameVirtualHost 172.20.30.50
<VirtualHost 172.20.30.50>
DocumentRoot /www/example1
ServerName www.example1.com
</VirtualHost>
<VirtualHost 172.20.30.50>
DocumentRoot /www/example2
ServerName www.example2.org
</VirtualHost>
RewriteEngine On
# now the rewriting rules......
RewriteRule ^mainserver$ mainserver/index.jsp
RewriteRule ^example1$ example1/index.jsp
RewriteRule ^example2$ example2/index.jsp
HTH
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business
of Sender. This transmission is of a confidential nature and Sender does not
endorse distribution to any party other than intended recipient. Sender does
not necessarily endorse content contained within this transmission.
> Date: Wed, 4 Mar 2009 02:00:45 +0000
> From: [email protected]
> To: [email protected]
> Subject: URL Rewriting for implementing virtual hosts
>
> We have a bunch of web applications packed into a single VM tomcat (6.0.14).
> I am looking to segrgating the contexts in distinct VMs based on IP address
> based virtual hosts.
>
> I assume that to keep this segregation transparent to the applications
> themselves,
> URL rewriting has to be incorporated (if there is another method, pl let me
> know).
>
> Questions:
>
> 1) Are there recommended best practices for implementing virtual hosts
> with URL rewrite?
>
> 2) We use Tomcat without Apache frontend and plan to use
> the Tuckey.org's URL rewriter. Anyone have any bad experience with this?
>
> 3) I assume that we would have to use a dummy webapp to rewrite the URL
> based on virtual host configuration and forward the request. Is there a
> better way?
>
> Thanks
>
> /U
_________________________________________________________________
Windows Liveā¢: Life without walls.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009