A nice error page can make your website more user friendly. You know there are several kinds of error can occur in a web application or website and they have their own status codes. If you handle them smart way then it can create a good impression for your website. One of the most common and popular way for handing this error is htaccess. By using .htaccess file(s) on a Linux Apache server we can easily to create our own custom error pages. You just need to create your custom error pages and then add this following code to your .htaccess file:
ErrorDocument 401 error_folder/401.php ErrorDocument 403 error_folder/403.php ErrorDocument 404 error_folder/404.php ErrorDocument 500 error_folder/500.php
Note: You should replace the error_folder/401.php with your own file path and name. Example: my_error_pages/401.php.
You can also checkout some error page examples.