Tomcat Url重写是重定向,而不是在后端重写
我认为tuckey urlrewrite过滤器会在后端重写URL。就像我输入地址栏Tomcat Url重写是重定向,而不是在后端重写,tomcat,rewrite,tuckey-urlrewrite-filter,Tomcat,Rewrite,Tuckey Urlrewrite Filter,我认为tuckey urlrewrite过滤器会在后端重写URL。就像我输入地址栏http://localhost:8080/TEST/some/yo我希望该地址保留在地址栏中,但在后端,以便Tomcat像键入http://localhost:8080/TEST/jspinwebinftest/?param=yo但将其重定向到http://localhost:8080/TEST/jspinwebinftest/?param=yo并在地址栏中显示 如何让它只在后端重写URL?这是我的urlrewr
http://localhost:8080/TEST/some/yo
我希望该地址保留在地址栏中,但在后端,以便Tomcat像键入http://localhost:8080/TEST/jspinwebinftest/?param=yo
但将其重定向到http://localhost:8080/TEST/jspinwebinftest/?param=yo
并在地址栏中显示
如何让它只在后端重写URL?这是我的urlrewrite.xml:
<?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>
<from>^/some/(.*)$</from>
<to type="redirect">/TEST/jspinwebinftest/?param=$1</to>
</rule>
</urlrewrite>
^/部分/(*))$
/TEST/jspinwebinftest/?参数=$1
我找到了答案。其实很简单。我需要删除tuckey网站上示例XML中的type=“redirect”
。我发现在重定向时,您必须将上下文应用程序添加到标记中,但在不重定向时,您不应该:
<?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>
<from>^/some/(.*)$</from>
<to>/jspinwebinftest/?param=$1</to>
</rule>
</urlrewrite>
^/部分/(*))$
/jspinwebinftest/?参数=$1