日期:2014-05-18  浏览次数:20689 次

关于urlrewrite
urlrewrite.xml中的配置如下:
<urlrewrite>
  <rule>
  <note/>
  <from>/first_([0-9]+)_([0-9]+).html</from>
  <to>/first.jsp?country=$1&amp;city=$2</to>
  </rule>

</urlrewrite>
测试访问:http://localhost:8081/Who/first_3444_2.html 则顺利通过。
我在地址栏中随便填写,如:http://localhost:8081/Who/first_3444_2.html~~~~~ 则信息还可以显示,
请问,如果对其进行过滤,也就是说如果html后有其它字符 进行过滤。请教大家,谢谢。

------解决方案--------------------
<urlrewrite> 
<rule> 
<from> ^/first_([0-9]+)_([0-9]+).html$ </from> 
<to> /first.jsp?country=$1&amp;city=$2 </to> 
</rule> 

</urlrewrite> 

就可以了
------解决方案--------------------
全匹配,加^开始符,结束符$