Handling multiple 404's?

Consider having two routes one is the frontpage the other for the backend.
Currently when triggering a 404 on the frontpage it shows the not found page.
When doing the same on the backend route it redirects to the front page to display the not found page.

Is there a way to display a not found page while staying in the backend url/route?

You can register to the notFoundHandler and handle specific pages differenty

Example code:

   $c = new Container();
    $c["notFoundHandler"] = function (Container $c) {
        return function (Request $req, Response $resp) use ($c) {
            //get url with $request->getUri()->getPath()
            return $resp->withStatus(404);
   $app = new App($c);
1 Like

Thanks for the reply, i’ll test it out.