使用Urlrewrite技术实现Struts2+Hibernate3+Spring的项目的伪静态

小弟做了一个项目,现在SEO要求我将所有的页面实现伪静态,尝试了多种技术,决定用Urlrewrite技术,下面是我的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">
        
<urlrewrite>
     <rule>
          <from>^/index.html</from>
          <to>/index.jsp</to>
     </rule>
    
     <rule>
          <from>^/about_cepai/about_cepai.html</from>
          <to>/about_cepai/about_cepai.jsp</to>
     </rule>
    
     <rule>
          <from>^/results_show/show.html</from>
          <to>/results_show/show.jsp</to>
     </rule>
    
     <rule>
          <from>^/service/service_support.html</from>
          <to>/service/service_support.jsp</to>
     </rule>
    
     <rule>
          <from>^/application/applicationFactory.jsp.html</from>
          <to>/application/applicationFactory.jsp.jsp</to>
     </rule>
     
     <rule>
          <from>^/contect_us/contect_us.jsp.html</from>
          <to>/contect_us/contect_us.jsp.jsp</to>
     </rule>
 
 
    
    <rule>
        <from>^/meterpro/([0-9]+)_([0-9]+).html$</from>
        <to>/meterpro?nid=$1&amp;tid=$2</to>
    </rule>

    
</urlrewrite>

有不带参数的页面都可以实现,像最下面的<from>^/meterpro/([0-9]+)_([0-9]+).html$</from><to>/meterpro?nid=$1&amp;tid=$2</to>,带有参数的jsp页面始终无法实现伪静态。希望各位牛人指点迷津。

发布了28 篇原创文章 · 获赞 3 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/wodetongnian/article/details/8570832