SEO优化 UrlReWrite(Url重写或伪静态)

使用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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值