If you want to design the custom error page for the server side error like 400, 401, 500, 502, and etc…, then keep your close attention in this as I am going to explain how to set custom error pages using Htacess file.
Open your htacess file from root directory of your website and copy paste below code at the end the file and save it. You can change the file name in the below code.
1 2 3 4 5 6 7 8 9 10 | ErrorDocument 400 /400.html ErrorDocument 401 /401.html ErrorDocument 403 /403.html ErrorDocument 404 /404.html ErrorDocument 405 /405.html ErrorDocument 408 /408.html ErrorDocument 414 /414.html ErrorDocument 500 /500.html ErrorDocument 502 /502.html ErrorDocument 504 /504.html |
You can also create a folder in the root directory and keep all your errors page inside that folder. In this case, use the below code in htacess
1 2 3 4 5 6 7 8 9 10 | ErrorDocument 400 /errors/400.html ErrorDocument 401 /errors/401.html ErrorDocument 403 /errors/403.html ErrorDocument 404 /errors/404.html ErrorDocument 405 /errors/405.html ErrorDocument 408 /errors/408.html ErrorDocument 414 /errors/414.html ErrorDocument 500 /errors/500.html ErrorDocument 502 /errors/502.html ErrorDocument 504 /errors/504.html |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: 404 error fix, 408 error, 502 error, 504 error, how to fix 404 error, htacess error, server error