Auto routing with modules in Codeigniter 4
01:54 28 Apr 2026

im pretty new with CI4, i am trying to use the "auto routing (improved)" feature along with modules. i want to access controllers/methods inside modules like this:

https://example.com/tracking/main/site

triggering the method "getSite" inside: /modules/tracking/controllers/Main.php

( according to the docs a controller method needs HTTP verb prefix like getIndex(), postCreate())

My directory structure is as follows

/app
/modules/Tracking
    /Controllers
    /Views
    /Models

app/config/Feature.php

 public bool $autoRoutesImproved = true;

app/config/autoload.php

public $psr4 = [
        APP_NAMESPACE => APPPATH,
        'Modules\Tracking' =>  ROOTPATH . 'modules/Tracking'
    ];

app/config/Routing.php

public bool $autoRoute = true;

public array $moduleRoutes = [
    'tracking' => 'Modules\Tracking\Controllers'
    ];
//(havent included the other things in the file)

According to this it should work: https://codeigniter.com/user_guide/incoming/auto_routing_improved.html#module-routing

but this contradicts it: codeigniter.com/user_guide/general/modules.html#routes

i know how to use manual Routing for in the Routes.php file. But that will become verry cumbersome in the long run.

php codeigniter routes codeigniter-4