You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Luca Ventura <ve...@libero.it> on 2002/07/03 15:28:59 UTC

How I can redirect requests in Tomcat 4?

Hello everybody!

I have Tomcat 4 installed as Web Server on a Win 2000 machine. I would like
to know how  I can redirect requests from an URL to another one. For example
I would like to redirect all the requests for this url:

http://www.mydomain.com/address1.html


to this new url:

http://www.newdomain.com/address2.html


How can I set Tomcat 4 to do this? Which configuration files must I modify?

Thanks a lot in advance!

               Luca


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


R: How I can redirect requests in Tomcat 4?

Posted by Luca Ventura <ve...@libero.it>.
Ok,
sorry for the cross-posting...:-)

Anyway I need to know how to implemenent the second solution you said,
that is to say I want that  Tomcat intercepts the requests for a resource
and
automatically redirects them without executing a page/servlet.

If someone knows how to configure Tomcat to do this I pray him
to let me know...thanks!

   Luca

-----Messaggio originale-----
Da: Michael Locasto [mailto:locasto@cs.columbia.edu]
Inviato: mercoledì 3 luglio 2002 16.23
A: Tomcat Developers List
Cc: Luca Ventura
Oggetto: Re: How I can redirect requests in Tomcat 4?


Luca,

This question should not be cross-posted to the dev list.

You can accomplish this with a simple javascript command embedded
in the requested page


<script language = "javascript">
        location.href="http://www.newlocation.com/address2/";
</script>


-or-

check out the servlet api

( javax.servlet.http.HttpServletResponse.redirect() )

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/servletapi/index.html

which is basically the same thing. These are quick and dirty.

I am not sure that if Tomcat can intercept requests for a resource and
automatically redirect them without executing a page/servlet, maybe
someone else more involved knows.

Regards,
Michael Locasto


----- Original Message -----
From: "Luca Ventura" <ve...@libero.it>
To: "tomcat-user" <to...@jakarta.apache.org>; "tomcat-dev"
<to...@jakarta.apache.org>
Sent: Wednesday, July 03, 2002 9:28 AM
Subject: How I can redirect requests in Tomcat 4?


> Hello everybody!
>
> I have Tomcat 4 installed as Web Server on a Win 2000 machine. I would
like
> to know how  I can redirect requests from an URL to another one. For
example
> I would like to redirect all the requests for this url:
>
> http://www.mydomain.com/address1.html
>
>
> to this new url:
>
> http://www.newdomain.com/address2.html
>
>
> How can I set Tomcat 4 to do this? Which configuration files must I
modify?
>
> Thanks a lot in advance!
>
>                Luca
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How I can redirect requests in Tomcat 4?

Posted by Michael Locasto <lo...@cs.columbia.edu>.
Luca,

This question should not be cross-posted to the dev list.

You can accomplish this with a simple javascript command embedded
in the requested page


<script language = "javascript">
        location.href="http://www.newlocation.com/address2/";
</script>


-or-

check out the servlet api

( javax.servlet.http.HttpServletResponse.redirect() )

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/servletapi/index.html

which is basically the same thing. These are quick and dirty.

I am not sure that if Tomcat can intercept requests for a resource and
automatically redirect them without executing a page/servlet, maybe
someone else more involved knows.

Regards,
Michael Locasto


----- Original Message -----
From: "Luca Ventura" <ve...@libero.it>
To: "tomcat-user" <to...@jakarta.apache.org>; "tomcat-dev"
<to...@jakarta.apache.org>
Sent: Wednesday, July 03, 2002 9:28 AM
Subject: How I can redirect requests in Tomcat 4?


> Hello everybody!
>
> I have Tomcat 4 installed as Web Server on a Win 2000 machine. I would
like
> to know how  I can redirect requests from an URL to another one. For
example
> I would like to redirect all the requests for this url:
>
> http://www.mydomain.com/address1.html
>
>
> to this new url:
>
> http://www.newdomain.com/address2.html
>
>
> How can I set Tomcat 4 to do this? Which configuration files must I
modify?
>
> Thanks a lot in advance!
>
>                Luca
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How I can redirect requests in Tomcat 4?

Posted by eric aboudaram <er...@wanadoo.fr>.
<Host name="mydomain.com" debug="0" appBase="webapps/rep1"
unpackWARs="true">
        <Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"  prefix="mydomain_com_log." suffix=".txt"
              timestamp="true"/>
            <Context path="" docBase="" debug="0"
                    reloadable="true" crossContext="true"/>
  </Host>

  <Host name="newdomain.com" debug="0" appBase="webapps/rep2"
unpackWARs="true">
        <Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"  prefix="newdomain_com_log." suffix=".txt"
              timestamp="true"/>
            <Context path="" docBase="" debug="0"
                    reloadable="true" crossContext="true"/>
  </Host>

don't touch nothing else on the server.xml in conf  of tomcat
----- Original Message -----
From: "Luca Ventura" <ve...@libero.it>
To: "tomcat-user" <to...@jakarta.apache.org>; "tomcat-dev"
<to...@jakarta.apache.org>
Sent: Wednesday, July 03, 2002 3:28 PM
Subject: How I can redirect requests in Tomcat 4?


> Hello everybody!
>
> I have Tomcat 4 installed as Web Server on a Win 2000 machine. I would
like
> to know how  I can redirect requests from an URL to another one. For
example
> I would like to redirect all the requests for this url:
>
> http://www.mydomain.com/address1.html
>
>
> to this new url:
>
> http://www.newdomain.com/address2.html
>
>
> How can I set Tomcat 4 to do this? Which configuration files must I
modify?
>
> Thanks a lot in advance!
>
>                Luca
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


---
Ce message Envoi est certifié sans virus connu.
Protégé par l'antivirus AVG Deluxe.
Version: 6.0.373 / Base de données virus: 208 - Date: 01/07/2002


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>