So i'm trying to add a router to a custom 404 page but there's some few problems :
1 - index will not display anything if not inputed : 127.0.0.1/index
2 - if i go to a page that does not exists it justs says that the controller does not exist yet .
Routes :
$di['router'] = function () {
$router = new Router();
$router->setDefaultModule('frontend');
$router->setDefaultNamespace('Frontend\Controllers');
$router->removeExtraSlashes(true);
$router->notFound([
'module' => 'frontend',
'namespace' => 'Frontend\Controllers',
'controller' => 'error',
'action' => 'show404'
]);
$router->add("/admin", [
'module' => 'backend',
'namespace' => 'Backend\Controllers',
'controller' => 'index',
'action' => 'auth',
]);
return $router;
};
Controller
namespace Frontend\Controllers;
class ErrorController extends ControllerBase
{
public function indexAction()
{
}
public function show404Action()
{
echo "132";
}
}