Welcome Guest, Not a member yet? Register   Sign In
CI4: Code Module is showing 404 in live server (cPanel)
#1

I've added the module folder in ...\app\Config\Autoload.php

PHP Code:
public $psr4 = [
          APP_NAMESPACE => APPPATH// For custom app namespace
          'Config'      => APPPATH 'Config',
          'Blog'      => ROOTPATH 'example/Blog',
]; 

My directory:


Code:
/Home directory of main project folder
/example
    /Blog
        /Config
            /Routes.php
       /Controllers           
           /Blog.php


Routes.php


PHP Code:
namespace Config;

// Create a new instance of our RouteCollection class.
$routes Services::routes();

$routes->get('blog''blog::index', ['namespace' => 'Blog\Controllers']); 


Blog.php


PHP Code:
namespace Blog\Controllers;

class 
Blog extends \CodeIgniter\Controller {

    function index() { 
        echo "Code module";
    }




After running my_domain/index.php/blog, it's showing this error:

Code:
404 - File Not Found

Controller or its method is not found: \Blog\Controllers\blog::index

But it's working fine in my localhost server. 
Reply


Messages In This Thread
CI4: Code Module is showing 404 in live server (cPanel) - by ciddict - 07-27-2021, 01:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB