Welcome Guest, Not a member yet? Register   Sign In
Problems with autorouting
#1

(This post was last modified: 02-15-2025, 03:55 PM by 4usol.)

Hi,

since dynamic routes are not allowed in ci4, i try to setup the autorouting (improved) to get nearly the same situation like the ci3 dynamic routes ( i cannot and wont define for every controller own static routes).

So like the docu i do the following steps.

1) App/Routing
Code:
public bool $autoRoute = true;

2) App/Feauture
Code:
public bool $autoRoutesImproved = true;

3) App/Routes.php
Code:
//$routes->get('/', 'Home::index'); //Disabled because autorouting!
//$routes->get('mysubfolder/', '\App\Controllers\mysubfolder\mycontroller::index');//Disabled because autorouting!
 
also i have overwrite the 404error
//Error 404
Code:
$routes->set404Override(function(){ die("test routes set404 > STOPP >".$_SERVER['HTTP_HOST'].' '.$_SERVER['REQUEST_URI']); } );

If i understand it corretly, autorouting only works if there is no single static rule for the controller defined in Routes.php.

(I use the shield-authentification, maybe its important to notice, or not.)

After i do the changes, no page is avivable anymore. I only get my 404-error "test routes set404..."

Before i change it all pages will shows as they should. Now nothing works...

What i do wrong?
Reply


Messages In This Thread
Problems with autorouting - by 4usol - 02-15-2025, 03:54 PM
RE: Problems with autorouting - by InsiteFX - 02-15-2025, 11:06 PM
RE: Problems with autorouting - by 4usol - 02-16-2025, 09:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB