Welcome Guest, Not a member yet? Register   Sign In
CI4 Auto-Discovery not working on dedicated server (cpanel)
#1

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.
Reply
#2

(This post was last modified: 05-10-2025, 04:20 AM by InsiteFX. Edit Reason: Added slash examples )

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',
]; 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB