【问题标题】:Url Rewrite is redirecting rather than rewriting in backendUrl Rewrite 是重定向而不是在后端重写
【发布时间】:2014-05-15 07:41:50
【问题描述】:

我认为 tukey-urlrewrite-filter 会在后端重写 URL。因此,就像我在地址栏中输入 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>

【问题讨论】:

    标签: tomcat rewrite tuckey-urlrewrite-filter


    【解决方案1】:

    我找到了答案。其实很简单。我需要删除 tukey 网站上示例 XML 中的 type="redirect"。而且我发现重定向时,你必须在to标签中添加你的上下文应用程序,但是当不重定向时,你不应该:

    <?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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-14
      • 2015-07-09
      • 1970-01-01
      • 1970-01-01
      • 2011-09-28
      • 1970-01-01
      • 2013-06-12
      • 1970-01-01
      相关资源
      最近更新 更多