This example shows you how to define custom error pages in .htaccess file and also how to display the error page on your site.
You may create separate files for each error, described in Sample 1 or just create the one PHP file for Sample 2. Here the PHP template for dealing with any sort of error, if you want to keep it simple:
source: http://www.apphp.com/index.php?snippet=htaccess-custom-error-pages