Wrox Programmer Forums
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 30th, 2006, 03:46 AM
Registered User
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to santhosh.irtt
Default URL Redirection

Hi Everybody,

Am using Tomcat 5.0 . My requirement is to redirect the URL "http://username.mysite.com" to "http://username.mysite.com/application.do?login_name=username". The URL should be nice URL , in the sense the New URL should not be reflected in the address bar. If the user invokes the URL http://mysite.com directly, i will bring him the login page. The URL "http://username.mysite.com" is the URL in which he can view his applications created using the tool am devoloping.

Please help me in this regard.....

Thanks and Regards,
Old July 1st, 2006, 08:07 PM
Friend of Wrox
Join Date: Jan 2006
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Santhosh,

To do this solely in Apache Tomcat, modify ROOT.war in /webapps/ so that welcome-file (as defined in /WEB-INF/web.xml) points to a JSP that redirects to your desired URL. This JSP can be something like this:

<% response.sendRedirect("/application.do?login_name=username"); %>

You may want to use a forward instead, which would be more efficient but it would not change how the URL looks in the browser location bar. Alternatively, you can use your web server front-end, either a load-balancer like an F5, or Apache HTTP Server with mod_rewrite, to do the redirection without putting load on your Java application server.

Jon Emerson

Similar Threads
Thread Thread Starter Forum Replies Last Post
redirection Tomcat mohamma_reza Apache Tomcat 1 July 13th, 2007 03:40 PM
URL Redirection Problem rch123 Need help with your homework? 0 June 18th, 2007 11:20 AM
Redirection andyw ASP.NET 2.0 Basics 2 May 29th, 2006 05:23 PM
Download and Redirection wolverine4277 PHP How-To 5 December 23rd, 2004 05:32 PM
Redirection a5xo3z1 Beginning PHP 4 June 19th, 2003 02:24 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.