How I can show 404 if locale invalid? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: How I can show 404 if locale invalid? (/showthread.php?tid=74913) |
How I can show 404 if locale invalid? - XTAZ - 11-24-2019 How I can show 404 if locale invalid? My route: $routes->add('{locale}', 'App\Controllers\Home::index'); But if I try open mysite.com/asdasdasd, or mysite.com/dad2da ... - I get HTTP code 200, I want get 404. I must write crutch? Then, if I write filter, how I detect what first segment used as locale, not controller? RE: How I can show 404 if locale invalid? - mboufos - 11-25-2019 tbh i dont know about CI4 but i will save the locale on cookie and just load it RE: How I can show 404 if locale invalid? - XTAZ - 11-25-2019 (11-24-2019, 11:58 AM)XTAZ Wrote: How I can show 404 if locale invalid?I write this code: PHP Code: <?php namespace App\Filters; |