CodeIgniter Forums
CI4 Auto-Discovery not working on dedicated server (cpanel) - 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: CI4 Auto-Discovery not working on dedicated server (cpanel) (/showthread.php?tid=92881)



CI4 Auto-Discovery not working on dedicated server (cpanel) - cypressit - 05-09-2025

I am working on a prototype using Modules. Everything is working fine in xampp on my windows desktop. When I deploy it to my dedicated server, it cannot find the routes

Folder structure
app
     Config
         Autoload
         Routes
cits
     Blog
          Config
               Routes
          Controllers
               Blog

FILES:

app\Config\Routes
----------------------------------------------------------
service('auth')->routes($routes);
$routes->get('/', 'Home::index');


app\Config\Autoload
---------------------------------------------------------
public $psr4 = [
    APP_NAMESPACE => APPPATH,
    'Config' => APPPATH . 'Config',
    'Cits\Settings' => ROOTPATH . 'cits\Settings',
    'Cits\Blog' => ROOTPATH . 'cits\Blog',
];

\cits\Blog\Config\Routes
---------------------------------------------------------
$routes->group("blog", ["namespace" => "\Cits\Blog\Controllers"], function ($routes) {
    $routes->get("/", "Blog::index");
});
Error I receive:  Can't find a route for 'GET: blog'.

Any idea why this is not working.


RE: CI4 Auto-Discovery not working on dedicated server (cpanel) - InsiteFX - 05-09-2025

Your Autoload is structure wrong look at your slash's and at mine below.

Namespaces use a \ back slash paths use a / forward slash.

Check your Routes:

PHP Code:
php spark Routes 


PHP Code:
app\Config\Autoload
---------------------------------------------------------
public 
$psr4 = [
    APP_NAMESPACE => APPPATH,
    'Config' => APPPATH 'Config',
    'Cits\Settings' => ROOTPATH 'cits/Settings',
    'Cits\Blog' => ROOTPATH 'cits/Blog',
];