So I’m using a single entry point found in a previous question of mine: How to include config.php efficiently?
We all know what 404 errors is, so no explanation needed there. However, when using the single entry point index.php?page=pokemon, it doesn’t go to the 404 page when trying to access a page that is non-existent. So how can I solve this problem which would make it more user friendly and direct the visitors to my 404 page so they won’t see all the PHP errors?
You should output your own error page (you could just
include()a .html file, for example), and set the HTTP status code using theheader()function:Of course, you must set the header before including the error template.