tomcat同个端口配置多个项目后无后缀的页面跳转

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.io.*,java.util.*"%>
<html>
<html>
<head>
<title>页面重定向</title>
</head>
<body>

	<h1>页面重定向</h1>

	<%
		// 重定向到新地址
		String site = new String(
				"http://XXX.com"); //此处更改为跳转地址
		//String site = new String("http://www.baidu.com");
		response.setStatus(response.SC_MOVED_TEMPORARILY);
		response.setHeader("Location", site);
	%>

</body>
</html>

  将这段代码替换到项目tomcat文件下的/webapps/ROOT/index.jsp进行替换。

服务器无此文件则将ROOT文件夹放到服务器指定的目录下。

原文地址:https://www.cnblogs.com/dybk/p/7661160.html