Ric*_*ard 3 webserver lighttpd http-status-codes http-status-code-404
我正在使用带有静态 404 页面的 lighttpd 404 错误处理程序。整个 conf 文件如下所示:
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" )
}
}
Run Code Online (Sandbox Code Playgroud)
但是,当我转到一个应该是 404 的地址时,我确实正确地看到了我们的 404 页面,但状态代码是 200。
该lighttpd的文档说,你应该如果使用的是静态页面得到404个状态码。
我认为我们正在使用静态页面,但是我们重定向的方式是否意味着我们实际上不是?
对不起,新手问题。
通过使用server.errorfile-prefix来修复此问题- 认为它只是server.error-handler-404.
似乎是lighttpd 某些版本中的一个已知错误。我实际上使用的是比 1.4.17 更高的版本,但仍然看到同样的问题。