I only want to re-link old uri to home page and any request which does not exist to error page. I added
<error-page> <error-code>404</error-code> <location>/404.jsp</location> </error-page> to web.xml and used below code which I found after google but request.getRequestURI() returns 404.jsp rather then the old-page.html, so it did not redirect the request. <% //get the requested URI String requestedLocation = request.getRequestURI(); //variable to store new location, if it exists String newLocation; /* do a database lookup (or other means to match up the requested URI with one you wish to redirect). */ if (requestedLocation.equals("/myApp/old-page.html")) { /*add some code in here to set the newLocation variable to a valid page*/ newLocation = "http://localhost:8080/myApp/"; //send HTTP 301 status code to browser response.setStatus(response.SC_MOVED_PERMANENTLY); //send user to new location response.setHeader("Location", newLocation); } %> -- View this message in context: http://www.nabble.com/Tomcat-301-redirect-tp25139277p25139686.html Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org