![]() |
How to show 404 page in Codeigniter 4? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: How to show 404 page in Codeigniter 4? (/showthread.php?tid=86922) |
How to show 404 page in Codeigniter 4? - WateUhlerredyh - 02-27-2023 Although it may seem trivial, I am having difficulty with a question. Previously in Codeigniter 3, I utilized the show_404() function in any controller to display a 404 page. How can I achieve the same outcome in Codeigniter 4? RE: How to show 404 page in Codeigniter 4? - datamweb - 02-27-2023 You can use the following command to display it. PHP Code: throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound(); But if you want to use show_404(), you can add the following code in file app/Common.php. PHP Code: <?php RE: How to show 404 page in Codeigniter 4? - kenjis - 02-27-2023 If you want to use CI3 features in CI4, you may find ci-3-to-4-upgrade-helper helpful. For example, https://github.com/kenjis/ci3-to-4-upgrade-helper/blob/1.x/src/CI3Compatible/Core/Common.php#L52 |