If page doesn't exist why not get error page

I misspelt the name of a page in a link. When I click on the link, to a page that doesn’t exist, it does not display my error page. But a page based on my default template. Why isn’t the error page being displayed?

I don’t know, a non-existing link should give you the error page.

I have a link, in a snippet, to a page called ‘newsletter’. I spelt newsletter wrongly to see what would happen:

<a href="/newslet.php">Subscribe to newsletter</a>

To my surprise it takes me to the following URL:

http://localhost:8888/newslet.php

and displayed a page based on my default theme.

I was expecting it to take me to the error page.

(I know writing <a href="/newslet.php">Subscribe to newsletter</a> doesn’t use PHP to check if the page exists. This was just an experiment)

Leaving aside that we have already discussed multiple times why such links are not very useful, when I test your example it in my environment, I do get a 404 response with a headline “Error”. And it is ok that it takes you to this URL, where else should it take you?

Do you have an error.php template to display the error page? If not, the default template will be used, which is probably why you are irritated.

Okay, I’ve gone to my error page and added a heading that will now display in my default theme. I’ve clicked the misspelt link again. Again it takes me to http://localhost:8888/newslet.php – is this to be expected? But this time the error page is displayed, with the heading, I’ve just added.

Well, yes. It’s just a non-existing page after all, why should it do anything else, or rather, what would you expect to happen?

I was expecting the URL to signal a problem or error:

http://localhost:8888/error
or
http://localhost:8888/404

But good to know that this is the expected behaviour!

Your current website behaves in the exact same way…

Sorry, completely newbie question!

Good to know that this is all as expected – and Kirby doesn’t use an error URL example.com/error when the error page is being displayed.