You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dean Searle <de...@computingoasis.com> on 2004/02/18 22:13:36 UTC

URL Redirect

Hello All,

 

I have a simple, yet allusive question. In Apache and Tomcat you can create Virtual Hosts. Within the Virtual Hosts you can specify different parameters. In Apache httpd.conf I can have the following:

<VirtualHost 192.168.1.1>
     ServerName www.domain1.com
     Redirect permanent / http://www.domain2.com/domain2
</VirtualHost>

 

Is there a feature like that in Tomcat, either in the server.xml or web.xml, I'm probably guessing server.xml.

Any help is greatly appreciated.

Thank you in advanced,

Dean



Re: URL Redirect

Posted by Duane Burchell <bu...@engsoc.org>.
On Wed, 18 Feb 2004, Dean Searle wrote:
> I have a simple, yet allusive question. In Apache and Tomcat you can create Virtual Hosts. Within the Virtual Hosts you can specify different parameters. In Apache httpd.conf I can have the following:

This is somewhat similar to the issue I was working on before (and will
hopefully be posting an update on soon).  I'll point you to
tuckey.org/urlrewrite.  He has essentially created a servlet version of
apache's mod_rewrite.  This would be one way of doing what you are looking
for.

> <VirtualHost 192.168.1.1>
>      ServerName www.domain1.com
>      Redirect permanent / http://www.domain2.com/domain2
> </VirtualHost>
>
> Is there a feature like that in Tomcat, either in the server.xml or web.xml, I'm probably guessing server.xml.

In web.xml, you would add in the <filter> code that is present on Paul
Tuckey's website (above).  You may need to alter you web.dtd to include
the new elements you are introducing.

The URLRewriter tool comes with an xml configuration file in which you can
state you rules.

If it is a redirect you want, add something like this :

<rule>
<from>www.domain1.com</from>
<to type="redirect">www.domain2.com/domain2</to>
</rule>

Make sure you download the latest version (0.8) or the URLRewriter.

Hope this helps.  There may be other ways of doing this, but if you have
questions about this method, just email me.
- Duane


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org