Welcome Guest, Not a member yet? Register   Sign In
routes not work, only default method, CI4
#4

(11-28-2019, 04:59 AM)InsiteFX Wrote: This is what it should look like

PHP Code:
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
$routes->setAutoRoute(true);

/**
 * --------------------------------------------------------------------
 * Route Definitions
 * --------------------------------------------------------------------
 */

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/''Home::index'); 

You are not telling us what your problem is so that we can understand it.


when i tried open  domain.com/public/main

it trigger 404 not found, buth method Home::main exist

$routes->get('/main', 'Home::index');

i tried multiple options, like remap and not appears take main from url... 

public function _remap($method)
{
        if ($method === 'some_method') {
               error_log("method arrive".$method);
                $this->$method();
        } else {
                $this->default_method();
        }
}


error_log("method arrive".$method); only print " index" not print main when i tried 
Reply


Messages In This Thread
RE: routes not work, only default method, CI4 - by gilber_fand - 11-28-2019, 10:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB