# Page visit error doesn't work

**URL:** <https://forum.getkirby.com/t/page-visit-error-doesnt-work/3534>\
**Category:** Questions\
**Tags:** v2\
**Created:** [March 7, 2016, 3:50pm UTC](https://forum.getkirby.com/t/page-visit-error-doesnt-work/3534 "2016-03-07T15:50:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [March 7, 2016, 3:50pm UTC](https://forum.getkirby.com/t/page-visit-error-doesnt-work/3534/1 "2016-03-07T15:50:57Z")

</div>

I have a very simple route in my config, but I can’t make it visit the error page. I don’t want to use `go` because I don’t want a redirect.

```php
c::set('routes', array(
	array(
		'pattern' => 'inbox/(:all)',
		'action' => function() {
			return page()->visit('error', 'sv');
		}
	)
));

```

- I know the pattern work.
- The visit page thing do something because when I do a print\_r it show an object and then crasch because of overload.
- When having it like this it shows nothing, a white page.
- I do have a page called `error` in my panel. I did not change that and I even tried to add a template called `error.php` without luck.

Any ideas?

---

<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 7, 2016, 5:06pm UTC](https://forum.getkirby.com/t/page-visit-error-doesnt-work/3534/2 "2016-03-07T17:06:00Z")

</div>

It has to be `site()->visit()` and not `page()->visit()`. 😉

Another improvement so that the route works even when changing the path of the error page:

```auto
$errorPage = site()->errorPage();
return site()->visit($errorPage->uri(), 'sv');

```

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [March 8, 2016, 6:37am UTC](https://forum.getkirby.com/t/page-visit-error-doesnt-work/3534/3 "2016-03-08T06:37:49Z")

</div>

I’ve read the docs, read forum threads, tested alot and it was a typo!? Oh, I’m feeling stupid right now.

I even tried the version with `errorPage` in a thread from @texnixe but of course it did not work because I still hade `page` instead of `site`.

Case solved.

---

<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:00pm UTC](https://forum.getkirby.com/t/page-visit-error-doesnt-work/3534/4 "2025-02-06T17:00:03Z")

</div>


