Web 重定向除一个文件夹和索引文件之外的所有Lighttpd通信

Web 重定向除一个文件夹和索引文件之外的所有Lighttpd通信,web,configuration,lighttpd,Web,Configuration,Lighttpd,我希望应用以下规则 $HTTP["host"] =~ "^www\.example\.com$" { url.redirect = ( "^/(.*)" => "http://newlocation.example.com/$1" ) } 但是,如果用户请求: index.html 根位置,即(www.example.com) 工具/* 请求应正常送达 www.example.com/>正常服务 www.example.com/tools/style.css->正常服

我希望应用以下规则

$HTTP["host"] =~ "^www\.example\.com$" {
        url.redirect = ( "^/(.*)" => "http://newlocation.example.com/$1" )
}
但是,如果用户请求:

  • index.html
  • 根位置,即(www.example.com)
  • 工具/*
请求应正常送达

www.example.com/>正常服务

www.example.com/tools/style.css->正常服务


www.example.com/example.html->

您可以匹配所有要正常提供服务的文件,然后使用
else
重定向其余文件。大概是这样的:

$HTTP["host"] =~ "^www\.example\.com$" {
    $HTTP["url"] =~ "^/(index\.html|tools/|)$" {
        server.document-root = "/path/to/files"
    } else {
        url.redirect = ( "^/(.*)" => "http://newlocation.example.com/$1" )
    }
}

不适合我,但我正在寻找类似的东西!lighttpd在使用此设置时给了我一个解析错误。我不能说我对此设置记得太多-您找到语法错误或其他方法了吗?