【问题标题】:UrlRewrite not for any resource filesUrlRewrite 不适用于任何资源文件
【发布时间】:2011-11-19 12:03:57
【问题描述】:

我正在使用 Tuckeys UrlRewrite 重定向在我的应用程序上发出的任何请求,以便我可以根据 url 执行一些操作。我需要能够捕获任何请求,但我不想从资源中获取请求,所以基本上它会是任何看起来像 /images/something.png/css/something.css,但我需要能够捕获 @例如 987654323@。基本上,资源只有几种可能性,我只是不知道如何排除它们。起初,我无法通过在正则表达式中没有 \. 来接受它们,但随后谷歌的示例将无法正常工作。所以我也需要捕捉这些点,而且由于我对正则表达式不太擅长,所以我也不知道如何捕捉 &。

所以我有两个问题:

  1. 除了可以以 /images/ 开头的资源(例如,如果它是 <condition> 元素,那么其他元素会很容易)之外,我如何捕获任何内容
  2. 如何也用 & 号捕获网址(实际上也可能在第一个问题中)

【问题讨论】:

    标签: java regex jakarta-ee url-rewriting


    【解决方案1】:

    您可以使用RewriteCond (doc) 来实现。

    【讨论】:

    • 嗯,你能举个例子吗?因为阅读文档,上面写着The goal of this rule is to force the use of a particular hostname, in preference to other hostnames which may be used to reach the same site. For example, if you wish to force the use of www.example.com instead of example.com, you might use a variant of the following recipe. 我不知道如何使用它
    猜你喜欢
    • 1970-01-01
    • 2019-08-22
    • 2013-01-14
    • 2017-10-28
    • 1970-01-01
    • 1970-01-01
    • 2019-12-28
    • 2012-12-02
    • 1970-01-01
    相关资源
    最近更新 更多