Your WordPress blog sends readers to a 404 Error page when they request for pages that don’t exist or have been moved. 404 means not found.
If your WordPress theme doesn’t have a 404.php template file, your blog redirects your readers to the front page in case of 404 errors. That might cause confusion because some readers will not know why they were sent back to the front page.
If your theme does have a 404.php template file, you can customize the error message and offer your readers some options on how to find the information they’re looking for or simply say, for example:
Not Found – This page doesn’t exist.
So what should you put in the 404.php file?
Simple, copy everything in the index.php file, paste it in the 404.php file, and then remove everything of The Loop, except for the Not Found area (after Else of The Loop).
An example of a customized 404:
<div class=”post”> <h2>Not Found</h2> </div>
Don’t copy and paste my codes. Type them out. Above the <div class=”post”> would be your headers and main column container or whatever you have that comes before the content. After the </div> would be your Sidebar and Footer or whatever you have that comes after the content.
You can take it a step further and give the reader a search form, right under the Not Found message:
<div class=”post”> <h2>Not found</h2> <div class=”entry”> <?php include(TEMPLATEPATH . ‘/searchform.php’); ?> </div> </div>
I wrote a lesson on how to include the search form in the sidebar, but you can also include the search form in other places.So now, Not Found is the title and the search form is the main content.