Closed lk-KEVIN closed 9 months ago
Hi, this works for me:
Flight::map('notFound', function(){
Flight::response(false)
->status(404)
->write(
file_get_contents(__DIR__ . '/lib/views/404.htm')
)
->send();
});
You may also use:
Flight::stop(404);
Or you can use
Flight::halt(404, 'Not found');
@n0nag0n also can be closed.
Thanks @krmu
Hi, I was trying to use a custom html file to replace the default error page, but the body returns 200 OK instead of 404 Not Found. Tried the code for issue #343 and everything was fine, return 404
then I try to Override using the example from the docs is when return 200 OK
What should I do? neither
http_response_code(404);
,header("HTTP/1.1 404 Not Found");
or ApacheErrorDocument 404 errors/404.html
return 404 Not FoundMy only solution is replace the original flight\Engine.php error message