# Problem with 404 code status and custom 404 page

**URL:** <https://discourse.laminas.dev/t/problem-with-404-code-status-and-custom-404-page/1746>\
**Category:** Mezzio\
**Created:** [July 18, 2020, 7:29pm UTC](https://discourse.laminas.dev/t/problem-with-404-code-status-and-custom-404-page/1746 "2020-07-18T19:29:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nepster-web](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/nepster-web/32/432_2.png) [@nepster-web](https://discourse.laminas.dev/u/nepster-web)\
**Post date:** [July 18, 2020, 7:29pm UTC](https://discourse.laminas.dev/t/problem-with-404-code-status-and-custom-404-page/1746/1 "2020-07-18T19:29:30Z")

</div>

So. I want create custom 404 page with my template.  
In my template I use twig function **path()**.

> <https://github.com/mezzio/mezzio-twigrenderer/blob/c938530f54728fe3102df18079fa0434e627692e/src/TwigExtension.php#L78>

If I pass to my 404 page I get exception

> <https://github.com/hugocfranciscon/atividade-zend-expressive/blob/416ec668bff98f859a98a552878e535fd82efbfb/vendor/zendframework/zend-expressive-helpers/src/UrlHelper.php#L153>

**What is this behavior for?**

it prevents me from using a nice 404 template with links.

---

<div class="post-metadata">

**Author:** ![nepster-web](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/nepster-web/32/432_2.png) [@nepster-web](https://discourse.laminas.dev/u/nepster-web)\
**Post date:** [July 18, 2020, 7:42pm UTC](https://discourse.laminas.dev/t/problem-with-404-code-status-and-custom-404-page/1746/2 "2020-07-18T19:42:50Z")

</div>

I think in this case it would be good practice to use the current url.

Basically, this will work (for **generateUriFromResult** ):

```auto
...
    if ($result->isFailure()) {
       return $_SERVER['PATH_INFO'] ?? '/';
    }
...

```
