`

tomcat域名转向

阅读更多

1、tomcat目录conf下

 

    server.xml

 

<Host name="www.xxx.com" debug="0">    
       		<Context path="" docBase="E:\Tomcat 6.0\webapps\hlcnc" debug="0"></Context>
    		
</Host>

2、在tomcat目录webapps下建立名称为hlcnc的web项目

    index.jsp

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<% response.setStatus(200);//可以防止有的浏览器不过滤一些错误页面%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
		<meta http-equiv='Refresh' content='0;URL=http://www.xxx.com'>
  </head>
  <body>
  </body>
</html>

   web.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 
	xmlns="http://java.sun.com/xml/ns/j2ee" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
	http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<!-- 过滤404、500错误-->
<error-page>
  <error-code>404</error-code>
  <location>/index.jsp</location>
</error-page>
<error-page>
  <error-code>500</error-code>
  <location>/index.jsp</location>
</error-page>
<!-- 过滤错误页-->
<error-page>
  <exception-type>java.lang.Throwable</exception-type>
  <location>/index.jsp</location>
</error-page>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics