Thursday, September 2, 2010

Java Servlet / JSP 301 and 302 Redirect Examples

Permanent 301 Redirect - Used to indicate than an existing page has a new home. For example, redirect a request to your new domain.
response.setHeader( "Location", "" );
response.setHeader( "Connection", "close" );
Temporary 302 Redirect - Used to send requests to a different location which can be used to handle errors. For example, send someone to your home page when they type in a URL that does not exist on your site.

No comments:

Post a Comment