urlrewrite.xml文件放到WEB-INF文件夹下:
<
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 >
< rule >
< from > /([a-z]+)$ </ from >
< to > /xblogx.do?url=$1 </ to >
</ rule >
< rule >
< from > /([a-z]+)/catalog/([0-9]+)$ </ from >
< to > /xblogx.do?url=$1 & catalog=catalog & id=$2 </ to >
</ rule >
< rule >
< from > /([a-z]+)/diary/([0-9]+)$ </ from >
< to > /xblogx.do?url=$1 & diary=diary & id=$2 </ to >
</ rule >
</ 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 >
< rule >
< from > /([a-z]+)$ </ from >
< to > /xblogx.do?url=$1 </ to >
</ rule >
< rule >
< from > /([a-z]+)/catalog/([0-9]+)$ </ from >
< to > /xblogx.do?url=$1 & catalog=catalog & id=$2 </ to >
</ rule >
< rule >
< from > /([a-z]+)/diary/([0-9]+)$ </ from >
< to > /xblogx.do?url=$1 & diary=diary & id=$2 </ to >
</ rule >
</ urlrewrite >