![]() |
Routes error - 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: Routes error (/showthread.php?tid=79273) |
Routes error - Bart Goossens - 05-20-2021 Problems with $routes - any idea When i add $routes->add('demo', 'Test'); $routes->add('demosub', 'Test::subtest'); the url https://bitest.ugent.be/demosub works the url https://bitest.ugent.be/test/subtest does not work. When I remove the routes https://bitest.ugent.be/test/subtest will work again. I have made a copy without the routes https://bitest.ugent.be/testother/subtest no htaccess in de root. htaccess in public folder (WWW) see https://codeshare.io/G743bj Routes files : https://codeshare.io/ax0nEB Test controller : https://codeshare.io/aJLJnZ CI4 V4.1.2 - fresh rollout via composer RE: Routes error - iRedds - 05-20-2021 I wanted to explain the reason, but it takes a long time. Therefore I say shortly. Don't use auto-detecting routes + wildcard route (add() method) Replace the add() method with the appropriate HTTP method. https://github.com/codeigniter4/CodeIgniter4/issues/4711 RE: Routes error - Bart Goossens - 05-21-2021 problem solved. Changed to PHP Code: $routes->match(['get', 'put'],'demo', 'Test'); both urls are working now the url https://bitest.ugent.be/demosub the url https://bitest.ugent.be/test/subtest |