Auto Routing and redirect() not working |
(12-10-2022, 05:58 PM)kenjis Wrote: Auto Routing (Legacy) should work with your first config. See below. The issue is now redirect(). After returning from vacation I upgraded the core framework to 4.3.1 then walked through all the upgrade path steps. Still no dice, so to troubleshoot I commented out all my defined routes except for the root directory $routes->get('/', 'Login::getIndex');. Then I ran php spark routes again and the autorouting began working. So, I figured that it was one of my defined routes breaking auto routing of all controllers. I uncommented each defined route individually down to uncommenting all of them but autorouting remained working. Oh well. After all that I'm still getting "The route for "testRoute" cannot be found." I can't seem to attach images, so I'll have to write this all in text. In Routes.php I have: PHP Code: $routes->get('/', 'Login::getIndex'); That is routing properly. At the end of the getIndex function in the Login controller I have: PHP Code: return redirect('testRoute'); Under app\Controllers\ I have TestRoute.php PHP Code: <?php When I navigate the browser to /public/ it loads getIndex() from Login.php but when it gets to the last line it kicks out: PHP Code: The route for "testRoute" cannot be found. It doesn't seem to matter what I change the controller to in the redirect() function. php spark routes clearly shows: PHP Code: | GET(auto) | testRoute | | \App\Controllers\TestRoute::getIndex | honeypot csrf invalidchars | honeypot secureheaders toolbar | It's unclear to me why redirect isn't working. Can redirect() no longer be used with auto routing like it could be in CI3? If I navigate to /public/testRoute/ it displays "hello world" as it should. |
Messages In This Thread |
Auto Routing and redirect() not working - by objecttothis - 12-06-2022, 08:22 AM
RE: Auto Routing (Legacy) not working - by InsiteFX - 12-06-2022, 11:40 PM
RE: Auto Routing (Legacy) not working - by objecttothis - 12-10-2022, 03:19 PM
RE: Auto Routing (Legacy) not working - by kenjis - 12-10-2022, 05:58 PM
Redirect() not working - by objecttothis - 01-30-2023, 12:44 AM
RE: Auto Routing and redirect() not working - by kenjis - 01-30-2023, 12:57 AM
RE: Auto Routing and redirect() not working - by objecttothis - 01-30-2023, 01:10 AM
|