Url rewriting Lighttpd rewrite if not文件不能在一条规则中处理*php和*html

Url rewriting Lighttpd rewrite if not文件不能在一条规则中处理*php和*html,url-rewriting,lighttpd,Url Rewriting,Lighttpd,为了启用缩短url服务,我必须在我的url中添加一个重写规则 lighttpd.conf。这似乎很重要,否则像 将返回404错误。这是因为Xf6Y 不是文件,而是短链接哈希 因此,我在lighttpd.conf中添加了以下行: url.rewrite-if-not-file=( “^/(.*)$”=>“/index.php?fwd=$1” ) 除了包含index.html的网站之外,这种方法工作得非常出色 而不是index.php 我试图复制重写规则,如url.rewrite-if-not-f

为了启用缩短url服务,我必须在我的url中添加一个重写规则 lighttpd.conf。这似乎很重要,否则像 将返回404错误。这是因为Xf6Y 不是文件,而是短链接哈希

因此,我在lighttpd.conf中添加了以下行:

url.rewrite-if-not-file=(
“^/(.*)$”=>“/index.php?fwd=$1”
)

除了包含index.html的网站之外,这种方法工作得非常出色 而不是index.php

我试图复制重写规则,如
url.rewrite-if-not-file=(
url.rewrite-if-not-file = (
        "^/(.)(\?.)?$" => "/index.php?fwd=$1",
        "^/(.)(\?.)?$" => "/index.html?fwd=$1"
)
“^/()(\?)?$”=>“/index.php?fwd=$1”,
“^/()(\?)?$”=>“/index.html?fwd=$1”
)
这导致了“重复规则”错误,因此lighttpd 无法重新启动


有人知道如何编写重写规则来重定向index.php和index.html吗?

您复制了哪些行?全部三个还是只有中间的一个?@d4只看中间的一个,这是有意义的。这两行的规则相同。因此,
Lighttpd
无法在两者之间进行选择。
url.rewrite-if-not-file = (
        "^/(.)(\?.)?$" => "/index.php?fwd=$1",
        "^/(.)(\?.)?$" => "/index.html?fwd=$1"
)