htaccess custom redirection of error pages.
Making the custom error pages makes the site seems much professional.
In order to show customized error pages we need to add the error number and related error pages in .htaccess file.
You can use custom error pages for any error as long as you know its number (like 404 for page not found) by adding the following to your .htaccess file:
The format of added error pages to the error number is below :
ErrorDocument errornumber /file.html
For example if the error code is 401 which is page not found error add the below line in the .htaccess page to show the custom error page (notfound.html). Add the file notfound.html in the root directory of the site.
ErrorDocument 404 /notfound.html
If the error page is not in the root directory of your site, you can enter the path to the file:
ErrorDocument 404 /path_to_custom_error_page.html
ErrorDocument 404 /errorpages/notfound.html
These are some of the most common errors:
401 – Authorization Required
400 – Bad request
403 – Forbidden
500 – Internal Server Error
404 – Wrong page
Some examples for other errors
You can read more about .htaccess by clicking here