Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

301 Redirects in JSP

Tags:

redirect

jsp

I am using 301 redirect to redirect my old website pages to the new site. The code for it as follows:

<%
response.setStatus(301);
response.setHeader( "Location", "http://my_new_website/page.html" );
response.setHeader( "Connection", "close" );
%>

So, whenever user reaches the old page, it will be automatically redirected to the new site page: http://my_new_website/page.html

Now I need a option like, during redirect from the old page to the new website, it must display an message something like "The website is moved" for a while and then automatically redirected the new website.

What should I do for this? Can anyone suggest a way for it?

like image 854
Sarathy Avatar asked Nov 04 '22 16:11

Sarathy


1 Answers

Alternatively, you could immediately redirect your user to the new site and check the referrer - if it is the old site, you could then present your user a message like "You have been redirected here because...".

like image 178
Barry Kaye Avatar answered Nov 09 '22 04:11

Barry Kaye