URLRewrite配置

web.xml
<!-- URL 伪静态过滤 -->
<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>WARN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
urlrewrite.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
        "http://tuckey.org/res/dtds/urlrewrite3.2.dtd">
<!--
Configuration file for UrlRewriteFilter
http://tuckey.org/urlrewrite/
-->
<urlrewrite decode-using="UTF-8">
<rule>
<from>^/$</from>
<to>/index.do</to>
</rule>
<rule>
<from>^(.*)/index(.*)\.html</from>
<to>/index.do</to>
</rule>
<rule>
<from>/news-type-(.*)\.html$</from>
<to>/news.do?act=findByType&amp;type=$1</to>
</rule>
<rule>
<from>/news-([0-9]+)\.html$</from>
<to>/news.do?act=findById&amp;newsId=$1</to>
</rule>

<outbound-rule>
<note>
The outbound-rule specifies that when response.encodeURL is
called (if you are using JSTL c:url) the url /rewrite-status
will be rewritten to /test/status/. The above rule and this
outbound-rule means that end users should never see the url
/rewrite-status only /test/status/ both in thier location
bar and in hyperlinks in your pages.
</note>
<from>/rewrite-status</from>
<to>/test/status/</to>
</outbound-rule>
</urlrewrite>

你可能感兴趣的:(html,C++,c,xml,Web)