onsofts
09-29-2005, 03:01 PM
How can I do this in coding?(Html or jsp...php etc..?)
Now I can only make temporary redirect (response code 302)
Tien-Chih Wang
Now I can only make temporary redirect (response code 302)
Tien-Chih Wang
![]() | View Full Version : Permanent Redirect onsofts 09-29-2005, 03:01 PM How can I do this in coding?(Html or jsp...php etc..?) Now I can only make temporary redirect (response code 302) Tien-Chih Wang stdunbar 09-29-2005, 03:29 PM In JSP you can do: <% response.sendRedirect( response.encodeRedirectURL( "http://www.domainname.tld/" ) ); %> and have this as the contents for index.jsp But what is your web server? If you're using Apache httpd (any version) you can create a virtual host that looks like: <VirtualHost *> ServerName whatever.olddomainname.tld Redirect permanent / http://www.domainname.tld/ </VirtualHost> or something similar. onsofts 09-29-2005, 03:50 PM Hi, Thank you for the response. I'm sorry I didn't say the question clearly. I want permanent redirect a web page to another folder in same domain, not different domain. I made some structure change and I don't expect the robot still crawl the old pages. Can I still use the code to make this? response.sendRedirect( response.encodeRedirectURL( "/destination.jsp" ) );l Tien-Chih Wang stdunbar 09-30-2005, 03:40 PM Sure, that'll work just fine. onsofts 09-30-2005, 03:58 PM thanks.......... sycript 10-02-2005, 06:24 PM you will want to use session.getServletContext().getRequestDispatcher("/destionation.jsp).forward(requiest,response) sycript 10-02-2005, 06:27 PM that will do internal request/response objects proxying , i like it more than sendRedirect :) |