![]() |
How can I add a 404 not found header to this code?
$routes->set404Override(static function () { return view('admin/others/error-page/error-404'); }); The problem with the code above is that when a page is not found (say a js script, css file etc...) the 404 header is not set and we cannot inspect which file failed loading. TIA. (11-24-2023, 08:46 PM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgnit...4#override Oh my... I should not have missed that crucial note! I appreciate your time. This is what I've come up with: Code: $routes->set404Override(static function () {
Okay, good!
However, it seems strange that "404 override" does not return 404 response by default...
You are correct @kenjis , it should return 404 response by default.
It is because of historical reasons.
I don't know why, but CI3 does like that. Personally, I would be happy to change it in the next minor version if it is well documented in: - upgrade guide from CI3 - upgrade guide to 4.5.0 - changelog 4.5.0 - section "404 Override" |
Welcome Guest, Not a member yet? Register Sign In |