Thursday, 17 January 2019 .::. Your IP: 54.205.211.87 
Home Internet & Networking Custom Error Pages for your website

Custom Error Pages for your website


This tutorial will guide you how to create custom error pages for your website using .htaccess.

Firstly you can create a folder named errors.
Now you will have to create the files that will be displayed as following:
/errors/badrequest.html - responds for 400 apache error
/errors/authreqd.html - responds for 401 apache error
/errors/forbid.html - responds for 403 apache error
/errors/notfound.html - responds for 404 apache error
/errors/serverr.html - responds for 500 apache error

Explaining the apache error messages:

Error 400:
This error 400 bad request, means that a request for a URL has been made but the server is not configured or capable of responding to it. This might be the case for URLs that are handed-off to a servlet engine where no default document or servlet is configured, or the HTTP request method is not implemented.

Error 401:
Website is blocked by the Administrator.

Error 403:
A 403 status code indicates that the client cannot access the requested resource. It means the wrong username and password were sent in the request, or that the permissions on the server do not allow what was being asked.

Error 404:
404 Not found - The requested URL / was not found on this server.

Error 500:
This error 500 internal server error, means that a request for a URL has triggered a fault with the Web server. It is likely that a server configuration change, CGI script, Java servlet, or other server side application has caused a fault.

Once you have created the appropriate error pages in the errors folder you need to add them to a .htaccess file in your public_html, www, htdocs or httpdocs domain folder. Create the .htaccess file if it doesn't exist and include the following inside it:

###################
# Custom Error Pages
###################
ErrorDocument 400 /errors/badrequest.html
ErrorDocument 401 /errors/authreqd.html
ErrorDocument 403 /errors/forbid.html
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/serverr.html
###################

Once you have set this you can test if it's working using the URL: http://your-website-name.ext/some-non-existing-file.html.


Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Facebook! Slashdot! StumbleUpon! TwitThis Joomla Free PHP