<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN" "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd"><urlrewrite> <rule> <note> The rule means that requests to /test/status/ will be redirected to /rewrite-status the url will be rewritten. </note> <from>/test/status/</from> <to type="redirect">%{context-path}/rewrite-status</to> <rule> <note>用户</note> <from>^/User_(.[0-9]*).html</from> <to>User.jsp</to> </rule> </rule></urlrewrite> 代码上就这样配置的
如果是tomcat或ngix,配置成代理就可以
如果是应用服务器处理,一个filter就可以,这样的例子网上很多,自己找一个
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN"
"http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd"><urlrewrite>
<rule>
<note>
The rule means that requests to /test/status/ will be redirected
to
/rewrite-status
the url will be rewritten.
</note>
<from>/test/status/</from>
<to type="redirect">%{context-path}/rewrite-status</to> <rule>
<note>用户</note>
<from>^/User_(.[0-9]*).html</from>
<to>User.jsp</to>
</rule>
</rule></urlrewrite>
代码上就这样配置的
http://redlight168.iteye.com/blog/1851426这个网站有详细的。