Add the following line to your .htaccess file:
code:
 ErrorDocument 404 http://www.yourdomain.com/YourErrorPage.htm [/code]

(the name and location of the error page can be altered)

You can also do other error codes, such as:
400 Bad syntax
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Error
502 Overloaded
503 Gateway Timeout