我使用lighttpd 404错误处理程序,具有静态404页面。整个配置文件如下所示:
server.document-root = "/home/www/local/www/mysite/html"
url.rewrite = (
"^(.*)/($|?.*)" => "$1/index.html",
"^(.*)/([^.?]+)($|?.*)$" => "$1/$2.html"
)
server.error-handler-404 = "/404.html"
$HTTP["scheme"] == "http" {
url.redirect = ( "^/blog.html$" => "/blog/",
// various individual redirects
)
}
$HTTP["scheme"] == "https" {
$HTTP["url"] !~ "^/blog/admin/" {
url.redirect = ( "^/(.*)" => "http://www.mysite.com/$1" )
}
}
然而,当我访问一个应该是404的地址时,我确实正确地看到了我们的404页面,但状态码是200。
lighttpd文档说,如果使用静态页面,您应该得到一个404状态码。
我认为我们使用的是静态页面,但是我们重定向的方式是否意味着我们实际上不是静态页面?
对于新手问题,我很抱歉。
通过使用server.errorfile-prefix
来修复此问题-认为这只是server.error-handler-404
中的一个bug。
似乎是某些版本的lighttpd中已知的错误。我实际上使用的是比1.4.17晚的版本,但仍然看到同样的问题。