Code example:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%// Go to iq.jspout.clearBuffer();response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);String param = request.getQueryString();response.setHeader("Location","iq.jsp"+(param==null?":("?"+param)));%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% // Go to iq.jsp out.clearBuffer(); response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); String param = request.getQueryString(); response.setHeader("Location","iq.jsp"+(param==null?":("?"+param))); %> As mentioned above, all accesses to download.jsp will be accessed and permanently redirected to iq.jsp
The parameters are also carried over at the same time.
If your redirection is cross-domain, or uses a full path, you can use
response.setHeader("Location","http://www.laozizhu.com/iq.jsp"+(param==null?"":("?"+param))); response.setHeader("Location","http://www.laozizhu.com/iq.jsp"+(param==null?"":("?"+param)));This way you can specify the complete turnover domain name.
The common method is to achieve 302 jump:
response.sendRedirect(http://www.baidu.com);
response.sendRedirect("http://www.baidu.com");