使用urlrewrite的步骤如下:
1.从http://tuckey.org/urlrewrite/ 下载最新的jar包下来
2、将urlrewrite.jar包导入需使用此功能项目的lib目录中去
然后在web.xml配置过滤器
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>ERROR</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3.然后是在/WEB-INF/下面新建urlrewrite.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.1//EN"
"http://tuckey.org/res/dtds/urlrewrite3.1.dtd">
<!--
Configuration file for UrlRewriteFilter
http://tuckey.org/urlrewrite/
-->
<urlrewrite>
<!--首页 -->
<rule>
<from>^/index.html$</from>
<to >/index.action</to>
</rule>
<rule>
<from>^/secondbuy.html$</from>
<to >/secondbuy/index.action</to>
</rule>
<!-- 商品评鉴 -->
<rule>
<from>^/evaluation.html$</from>
<to>/index.action?code=evaluation</to>
</rule>
<!-- 观点PK 观点-->
<rule>
<from>^/viewpoint/([a-zA-Z0-9_]+).html$</from>
<to>/viewpoint/getViewpointById.action?id=$1</to>
</rule>
<!-- 观点PK 观点-->
<rule>
<from>^/viewpointPkList.html$</from>
<to>/viewpoint/getViewpointList.action</to>
</rule>
<!-- 创业经 -->
<rule>
<from>^/venture.html$</from>
<to>/index.action?code=venture</to>
</rule>
<!-- 生意经 -->
<rule>
<from>^/bizSense.html$</from>
<to>/index.action?code=bizSense</to>
</rule>
<!-- 生意经 项目案例精选 -->
<rule>
<from>^/projMarrow.html$</from>
<to>/index.action?code=projMarrow</to>
</rule>
<!-- 达人会客厅 -->
<rule>
<from>^/interview.html$</from>
<to>/index.action?code=interview</to>
</rule>
<!-- 展会 -->
<rule>
<from>^/exhibit.html$</from>
<to>/index.action?code=exhibit</to>
</rule>
<!-- 商人社区 -->
<rule>
<from>^/businessCommunity.html$</from>
<to>/businessCommunity/index.action</to>
</rule>
<!-- 批发商城 -->
<rule>
<from>^/mall/wholesale.html$</from>
<to>/index.action?code=wholesale</to>
</rule>
<!-- 批发商城 产品列表一级分类页 -->
<rule>
<from>^/mall/goodslist/([a-zA-Z0-9_]+).html$</from>
<to>/mall/goodslist/list.action?id=$1</to>
</rule>
<!-- 批发商城 列表首页:团购列表/热销排行榜/ -->
<rule>
<from>^/mall/list/([a-zA-Z0-9_]+).html$</from>
<to>/mall/list/$1.action</to>
</rule>
<!-- 资讯详页 -->
<rule>
<from>^/information/([0-9]+).html$</from>
<to>/information/show.action?id=$1</to>
</rule>
<!-- 资讯列表-->
<rule>
<from>^/information/list_([a-zA-Z0-9_]+).html$</from>
<to>/information/list.action?code=$1</to>
</rule>
<!--专题 -->
<rule>
<from>^/special.html$</from>
<to >/special.action</to>
</rule>
<!--招商 -->
<rule>
<from>^/page.html$</from>
<to >/page.action</to>
</rule>
<!--首页 -->
<rule>
<from>^/$</from>
<to >/index.action</to>
</rule>
<!--展会详情-->
<rule>
<from>^/exhibit/show/([0-9]+).html$</from>
<to >/exhibit/show.action?id=$1</to>
</rule>
<!--展会资讯详情-->
<rule>
<from>^/exhibit/show_info/([0-9]+).html$</from>
<to >/exhibit/show_info.action?id=$1</to>
</rule>
<!--展会资讯详情-->
<rule>
<from>^/exhibit/list/([a-zA-Z0-9_]+).html$</from>
<to >/exhibit/list.action?code=$1</to>
</rule>
<!--展会资讯详情-->
<rule>
<from>^/exhibit/list_info/([a-zA-Z0-9_]+).html$</from>
<to >/exhibit/list_info.action?code=$1</to>
</rule>
</urlrewrite>
1.从http://tuckey.org/urlrewrite/ 下载最新的jar包下来
2、将urlrewrite.jar包导入需使用此功能项目的lib目录中去
然后在web.xml配置过滤器
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>ERROR</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3.然后是在/WEB-INF/下面新建urlrewrite.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.1//EN"
"http://tuckey.org/res/dtds/urlrewrite3.1.dtd">
<!--
Configuration file for UrlRewriteFilter
http://tuckey.org/urlrewrite/
-->
<urlrewrite>
<!--首页 -->
<rule>
<from>^/index.html$</from>
<to >/index.action</to>
</rule>
<rule>
<from>^/secondbuy.html$</from>
<to >/secondbuy/index.action</to>
</rule>
<!-- 商品评鉴 -->
<rule>
<from>^/evaluation.html$</from>
<to>/index.action?code=evaluation</to>
</rule>
<!-- 观点PK 观点-->
<rule>
<from>^/viewpoint/([a-zA-Z0-9_]+).html$</from>
<to>/viewpoint/getViewpointById.action?id=$1</to>
</rule>
<!-- 观点PK 观点-->
<rule>
<from>^/viewpointPkList.html$</from>
<to>/viewpoint/getViewpointList.action</to>
</rule>
<!-- 创业经 -->
<rule>
<from>^/venture.html$</from>
<to>/index.action?code=venture</to>
</rule>
<!-- 生意经 -->
<rule>
<from>^/bizSense.html$</from>
<to>/index.action?code=bizSense</to>
</rule>
<!-- 生意经 项目案例精选 -->
<rule>
<from>^/projMarrow.html$</from>
<to>/index.action?code=projMarrow</to>
</rule>
<!-- 达人会客厅 -->
<rule>
<from>^/interview.html$</from>
<to>/index.action?code=interview</to>
</rule>
<!-- 展会 -->
<rule>
<from>^/exhibit.html$</from>
<to>/index.action?code=exhibit</to>
</rule>
<!-- 商人社区 -->
<rule>
<from>^/businessCommunity.html$</from>
<to>/businessCommunity/index.action</to>
</rule>
<!-- 批发商城 -->
<rule>
<from>^/mall/wholesale.html$</from>
<to>/index.action?code=wholesale</to>
</rule>
<!-- 批发商城 产品列表一级分类页 -->
<rule>
<from>^/mall/goodslist/([a-zA-Z0-9_]+).html$</from>
<to>/mall/goodslist/list.action?id=$1</to>
</rule>
<!-- 批发商城 列表首页:团购列表/热销排行榜/ -->
<rule>
<from>^/mall/list/([a-zA-Z0-9_]+).html$</from>
<to>/mall/list/$1.action</to>
</rule>
<!-- 资讯详页 -->
<rule>
<from>^/information/([0-9]+).html$</from>
<to>/information/show.action?id=$1</to>
</rule>
<!-- 资讯列表-->
<rule>
<from>^/information/list_([a-zA-Z0-9_]+).html$</from>
<to>/information/list.action?code=$1</to>
</rule>
<!--专题 -->
<rule>
<from>^/special.html$</from>
<to >/special.action</to>
</rule>
<!--招商 -->
<rule>
<from>^/page.html$</from>
<to >/page.action</to>
</rule>
<!--首页 -->
<rule>
<from>^/$</from>
<to >/index.action</to>
</rule>
<!--展会详情-->
<rule>
<from>^/exhibit/show/([0-9]+).html$</from>
<to >/exhibit/show.action?id=$1</to>
</rule>
<!--展会资讯详情-->
<rule>
<from>^/exhibit/show_info/([0-9]+).html$</from>
<to >/exhibit/show_info.action?id=$1</to>
</rule>
<!--展会资讯详情-->
<rule>
<from>^/exhibit/list/([a-zA-Z0-9_]+).html$</from>
<to >/exhibit/list.action?code=$1</to>
</rule>
<!--展会资讯详情-->
<rule>
<from>^/exhibit/list_info/([a-zA-Z0-9_]+).html$</from>
<to >/exhibit/list_info.action?code=$1</to>
</rule>
</urlrewrite>