I am developing with PHP on an Apache web server. I would like to know if there's a way to force the server to serve a custom error page whenever any of the following events occurs:
- The page the user is looking for does not exist (I would like to serve the custom error page instead of the classic '404 Not Found');
- The user changed the value of the value='' attribute of an or the value of a name='' attribute and then send the form with wrong values (for example I have an where the value attribute represents the id of a product that is going to be purchased or an univocal row in a database that is going to be cancelled. I want to prevent ambiguous behaviour e.g. when the user changes the value attribute from the 'inspect element' browser's tool, and then submits a form;
- The user changed the ?query_string=value and then clicked on a link or submitted a form with action attribute set to "page.php?query_string=value".
So whenever any of these ambiguous events occur (I know it may seem stupid for a user to change the value of attributes of the input elements when purchasing something, but who knows) I would like to throw a page like the one on facebook with the broken finger when for example you try to visit https://www.facebook.com/hello.php.
How can I achieve that? Do I need to configure something or I can do it directly with PHP?
Thanks in regards!