Hi everyone,
I just came up with a thought about 404 errors. It’s suggested in the One-pager solution that we redirect the generated subpages to the error page. But a best practice would suggest to display the error at that precise URL, with no redirection.
I think Kirby should have a function that should be called when undesired URL get accessed to force display the error template and exit what’s next:
<?php if (!$page->isHomePage()) error(); ?>
EDIT: exactly like it currently does for URLs that doesn’t match any page of the content/ folder.
This page would automatically set the HTTP response code as 404.
And a plus would be to be able to give the error code as an argument (404 as default) :
<?php if (!$page->isHomePage()) error(403); ?>
What do you think about it?