With the following settings, you can easily create custom error pages and show them if an error is occured:
ErrorDocument 401 /error/401.php
ErrorDocument 403 /error/403.php
ErrorDocument 404 /error/404.php
ErrorDocument 500 /error/500.php
Note! Don’t forget to create error directory in the root directory of your hosting and to place the relevant files there.