PHP have one great file called .htaccess file. With this file you can do lots of stuff which you might have not imagine.
In this post I will show you the trick to set up the 404 handler using .htaccess file.
What is 404 Handler?
404 handle is just like a fallback page, which should be display when user visited the page which is not exists.
How to set 404 handler?
For setting up the 404 Handler, you just need to perform two simple steps.
First is to create a file which handles the 404 error and place/upload this file to the root of your server.
Now place below code in your htaccess file.
So from above code you can see that 404.php will be served when 404 Not Found occures.
So Easy :)
Pingback: Set Error Document with .htaccess | Expert PHP Developer