天天看點

使用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頁面始終無法實作僞靜态。希望各位牛人指點迷津。

繼續閱讀