How to create custom error pages

Sometimes when you are surfing your favourite website nothing you will get but only a white page with the error “404 ERROR” or some others.
What’s even more goofy about the error code is that it really doesn’t tell you what the issue is. Generally you’ve been advised that the server cannot discover what you want. It doesn’t tell you why, how to fix it, or where to go from that point. You really don’t have much option but to hit your BACK key,
But then you find a server that’s set up with its own unique 404 error web page that pleasantly apologizes and provides you link to e-mail website administrators. Now that’s class! and it is very simple to set up.
Common error codes are:

400(Bad request)
401(Authorization required)
402(Payment required)
403(Forbidden)
404(Not found)
405(Method not allowed)
406(Not acceptable)
407(Proxy authentication required)
408(Request timeout)
409(Conflict)
410(Gone)
411(Length required)
412(Precondition failed)
413(Request entity too large)
414(Request URI too large)
415(Unsupported media type)
416(Request range not satisfiable)
417(Expectation failed)
422(Unprocessable entity)
423(Locked)
424(Failed dependency)
500(Internal server error)
501(Not Implemented)
502(Bad gateway)
503(Service unavailable)
504(Gateway timeout)
505(HTTP version not supported)
506(Variant also negotiates)
507(Insufficient storage)
510(Not extended)

To create your custom error page, login to your cPanel click error pages and click the page you want to edit. Insert your own custom page code in HTML. After you click Save the changes will be applied.
custom error pages
Secondly a very basic fix of this problem is your .htaccess , You should have the one into your website directory if you will find it you can create a new one.
 Let’s Edit It
Add this to the .htaccess file:

 ErrorDocument 404 http://www.yourdomain.com/404page.html

You will of course need to put a 404page.html file in the main web directory for the  above directive to work.
The “ErrorDocument 404” instruction basically informs the Apache web server that whenever it cannot find the file it needs in that directory, it has to use the file specified in the URL .

 

Leave a Reply

Your email address will not be published. Required fields are marked *