![]() |
CodeIgniter 4 routes not working properly - 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: CodeIgniter 4 routes not working properly (/showthread.php?tid=78002) |
CodeIgniter 4 routes not working properly - DanielTheGeek - 11-17-2020 I just got into CI4 from a CI3 background but I'm finding it difficult to get routes to display the appropriate view. Even though I have written the code in the controller properly to load a view, it always returns index.php no matter what instead of the correct view even when I enter a non-existent route. The 404 page doesn't show either. Please, what am I missing? Here's my controller code:
Code: <?php Here's the result I get on the browser: ![]() RE: CodeIgniter 4 routes not working properly - InsiteFX - 11-17-2020 If you want it go to Shop then you need to create a route for it. Did you setup your base url in app/Config/App.php RE: CodeIgniter 4 routes not working properly - DanielTheGeek - 11-17-2020 (11-17-2020, 09:43 PM)InsiteFX Wrote: If you want it go to Shop then you need to create a route for it. Tried that, didn't work still. It doesn't show the 404 page for non-existent routes too. I noticed that the mod.rewrite module was disabled all this while by running "sudo a2query -m rewrite", I don't know if this helps. I'd enable the mod.rewrite module and see what happens. SOLVED: I simply enabled mod.rewrite by running "sudo a2enmod rewrite" and everything works as expected now. |