【问题标题】:Lighttpd Rewrite Rule (match not having a period)Lighttpd 重写规则(匹配没有句点)
【发布时间】:2012-07-22 04:34:13
【问题描述】:

我正在尝试为lighttpd 找出一条rewrite 规则,其行为方式如下:

如果 uri(协议和域之后的部分)包含period,则执行规则。

例子:

uri = "/people/add"
Should run the rule.

uri = "/js/main.js"
Should NOT run the rule.

uri = "/people.php"
Should NOT run the rule.

这是我到目前为止所拥有的,但它的行为并不像预期的那样,它总是运行规则:

$HTTP["host"] =~ "^(my\.domain\.com)$" {
    url.rewrite-once = (
            "^/(.*)$" => "index.php/$1"
    )
}

【问题讨论】:

    标签: regex mod-rewrite url-rewriting lighttpd


    【解决方案1】:

    也许为您的正则表达式尝试以下操作?我不熟悉 lighthttpd 支持的语法,但如果它支持字符类,下面应该按照你的要求做。

     "^/([^.]+)$"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-24
      • 1970-01-01
      • 2018-03-28
      • 2012-07-22
      • 1970-01-01
      • 2018-02-01
      相关资源
      最近更新 更多