urlwrite.xml

来源:互联网 发布:淘宝网什么最好卖 编辑:程序博客网 时间:2024/06/05 21:03




1. 下载jar包, 并加入到WEB-INF/lib下
2. 在WEB-INF/web.xml中增加下面的配置
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<!-- 拦截所有的url -->
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>


<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN"
        "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
<urlrewrite>

<rule>
<note>商品查看</note>
<from>^/goods_([0-9]+).htm$</from>
<to type="forward">/goods.htm?id=$1</to>
</rule>
<rule>
<note>wap商品查看</note>
<from>^/wap/goods_([0-9]+).htm$</from>
<to type="forward">/wap/goods.htm?id=$1</to>
</rule>
<rule>
<note>商品查看</note>
<from>^/goods_([0-9]+)_([a-z]+).htm$</from>
<to type="forward">/goods.htm?id=$1&amp;from=$2</to>
</rule>
<rule>
<note>商品商城分类查看</note>
<from>^/store_goods_list_?([0-9]+).htm$</from>
<to type="forward">/store_goods_list.htm?gc_id=$1</to>
</rule>
<rule>
<note>店铺查看</note>
<from>^/store_([0-9]+).htm$</from>
<to type="forward">/store.htm?id=$1</to>
</rule>
<rule>
<note>店铺导航</note>
<from>^/store_url_([0-9]+).htm$</from>
<to type="forward">/store_url.htm?id=$1</to>
</rule>
<rule>
<note>积分商城礼品查看</note>
<from>^/integral/view_([0-9]+).htm$</from>
<to type="forward">/integral/view.htm?id=$1</to>
</rule>
<rule>
<note>品牌查看商品</note>
<from>^/brand_goods_([0-9]+).htm$</from>
<to type="forward">/brand_goods.htm?id=$1</to>
</rule>
<rule>
<note>店铺分类</note>
<from>^/store_list_([0-9]+).htm$</from>
<to type="forward">/store_list.htm?sc_id=$1</to>
</rule>
<rule>
<note>商城活动</note>
<from>^/activity/index_([0-9]+).htm$</from>
<to type="forward">/activity/index.htm?id=$1</to>
</rule>
<rule>
<note>商品类团购信息查看</note>
<from>^/group/view_goods_([0-9]+).htm$</from>
<to type="forward">/group/view.htm?id=$1&amp;type=goods</to>
</rule>

<rule>
<note>资讯文章</note>
<from>^/cms/detail_([0-9]+).htm$</from>
<to type="forward">/cms/detail.htm?id=$1</to>
</rule>
<rule>
<note>地市首页</note>
<from>^/([A-z]+)/?$</from>
<to type="forward">/index1.htm?city=$1</to>
</rule>
<rule>
<note>列表页</note>
<from>^/([A-z]+)/buy/([-A-z\d]+)?$</from>
<to type="forward">/goodslist.htm?city=$1&amp;con=$2</to>
</rule>
</urlrewrite>

0 0