# Handling multiple 404's?

**URL:** <https://discourse.slimframework.com/t/handling-multiple-404s/972>\
**Category:** Questions\
**Created:** [December 1, 2016, 8:55am UTC](https://discourse.slimframework.com/t/handling-multiple-404s/972 "2016-12-01T08:55:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SVL](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@SVL](https://discourse.slimframework.com/u/SVL)\
**Post date:** [December 1, 2016, 8:55am UTC](https://discourse.slimframework.com/t/handling-multiple-404s/972/1 "2016-12-01T08:55:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![famoser](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/famoser/32/273_2.png) [@famoser](https://discourse.slimframework.com/u/famoser)\
**Post date:** [December 1, 2016, 11:31am UTC](https://discourse.slimframework.com/t/handling-multiple-404s/972/2 "2016-12-01T11:31:10Z")

</div>

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);
```

---

<div class="post-metadata">

**Author:** ![SVL](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@SVL](https://discourse.slimframework.com/u/SVL)\
**Post date:** [December 1, 2016, 7:48pm UTC](https://discourse.slimframework.com/t/handling-multiple-404s/972/3 "2016-12-01T19:48:40Z")

</div>

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