# Error Pages (http-error)

**URL:** <https://forum.getkirby.com/t/error-pages-http-error/125>\
**Category:** Questions\
**Tags:** v2\
**Created:** [March 2, 2015, 2:04pm UTC](https://forum.getkirby.com/t/error-pages-http-error/125 "2015-03-02T14:04:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ti\_Gr](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ti_gr/32/98_2.png) [@Ti\_Gr](https://forum.getkirby.com/u/Ti_Gr)\
**Post date:** [March 2, 2015, 2:04pm UTC](https://forum.getkirby.com/t/error-pages-http-error/125/1 "2015-03-02T14:04:17Z")

</div>

Hi everybody,

I would like to know how you guys handle your customs error pages?!  
Do you use “response::error” or “response::header” from the toolkit api?

How is Kirby handling with errors generally?  
Is everything returned to the error.php under templates? No matter if it’s a 404 or a 500?

Would be great to hear some different approaches 😊  
Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [March 2, 2015, 3:19pm UTC](https://forum.getkirby.com/t/error-pages-http-error/125/2 "2015-03-02T15:19:32Z")

</div>

> [@Ti\_Gr](#):
>
> Is everything returned to the error.php under templates?

`error.php` is the default template of the `error` page in the root of the content directory. It is used if no plugin stopped execution (for example with a route) and the page was not found. So yes, it’s a 404 error page. You don’t need to modify the HTTP status code, as it’s always set to 404 in that case.

> [@Ti\_Gr](#):
>
> No matter if it’s a 404 or a 500?

HTTP 500 is not handled by `error.php`, because it’s thrown if something goes very wrong. Normally this should not happen, so you don’t need a custom error page for that. If you really do, you can use the Apache `ErrorDocument` directive for that and serve a static error page.

---

<div class="post-metadata">

**Author:** ![Ti\_Gr](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ti_gr/32/98_2.png) [@Ti\_Gr](https://forum.getkirby.com/u/Ti_Gr)\
**Post date:** [March 2, 2015, 4:12pm UTC](https://forum.getkirby.com/t/error-pages-http-error/125/3 "2015-03-02T16:12:51Z")

</div>

Thank you for your reply.

> [@lukasbestle](#):
>
> HTTP 500 is not handled by error.php, because it’s thrown if something goes very wrong. Normally this should not happen, so you don’t need a custom error page for that. If you really do, you can use the Apache ErrorDocument directive for that and serve a static error page.

Okay, maybe the 500 error was a bad example. But what about 400 or 403? I want to achieve a single error page which can be used to show different errors.

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [March 2, 2015, 4:45pm UTC](https://forum.getkirby.com/t/error-pages-http-error/125/4 "2015-03-02T16:45:47Z")

</div>

That depends on your implementation and use-case. Do you want to handle these kinds of errors in routes, plugins or in templates directly? Or to be more general: When are the errors thrown?

If you have control over the place the errors are thrown and you aren’t already in the template, you can use `site()->visit('error');` to select the error page. Your error page will need to contain the logic to send the appropriate status code though.

---

<div class="post-metadata">

**Author:** ![Ti\_Gr](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ti_gr/32/98_2.png) [@Ti\_Gr](https://forum.getkirby.com/u/Ti_Gr)\
**Post date:** [March 4, 2015, 10:32pm UTC](https://forum.getkirby.com/t/error-pages-http-error/125/5 "2015-03-04T22:32:38Z")

</div>

Good questions…  
I should spend a few more thoughts about that :-/

Thanks for the input

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:20pm UTC](https://forum.getkirby.com/t/error-pages-http-error/125/6 "2025-02-06T17:20:49Z")

</div>

Archived on February 6, 2025, 5:20pm UTC


