Custom 404 Error Message Page
I was asked earlier by a friend how to create a custom 404 error page, So i figured i would write a small tutorial on it.
Why would i want a custom 404 error page?
The main reason for using a custom 404 error page is to add a little personality or humor to something that is, at the end of the day, a mistake on your part. Some people like to include a funny story about why the page is not there, Others prefer the heartfelt apology, But the main thing to include on this 404 error page is a link to your homepage, Which is something a regular 404 error page doesn't include.
First thing you need to do is instruct your server to use a specific page for your custom 404 error page instead of the usual boring page. We do this with an .htaccess file.
If you don't already have an .htaccess file in your root directory, Create one, Then put the following line into it.
ErrorDocument 404 http://www.domain.com/404-error-page.php
Change domain to your domain.
So now you know how to make your server display your custom 404 error message, What should we put on it? This is where your imagination comes in. It is a good idea to keep your error message lighthearted.. If you know PHP you could even make your 404 error message send you an email every time someone gets an error.