What are Error Pages?
While you work hard to make sure that every link actually goes to a specific web page on your site, there is always a chance that a link clicked is not available. If your visitors encounters an error, why not present your visitor with a message more useful than "NOT FOUND".
This lesson will teach you how to edit your "error" and "page not found" messages so they are more helpful to your visitors.
What are Error Codes?These numbered error codes are how the server tells website visitors about an error encountered. There are many different error codes that a server can deliver, but these are a few of the more common codes.
401 : Unauthorized - Access to the URL resource requires user authentication which either has not yet been provided, or which has been provided but failed. This is commonly known as password protection. Unless you have a good reason to do so, it is not recommended to redirect a 401 error.
403 : Forbidden - The request was a legal request, but the server is refusing to respond to it. Unlike a 401 Unauthorized response, authenticating will make no difference. This is usually due to a scripting or file permissions issue.
404 : Not Found - This response code indicates that the visitor was able to communicate with the server, but either the server could not find what was requested, or it was configured not to fulfill the request and not reveal the reason. Error 404 should not be confused with "server not found" or similar errors, in which a connection to the destination server cannot be made at all.
500 : Internal Server Error - Your web server encountered an unexpected condition that prevented it from fulfilling the request by the visitor. Basically, something has gone wrong, but the server can not be more specific about the error condition in its response to the visitor.
From the DirectAdmin main control panel menu, click the "Error Pages" icon. You will see a screen that looks like this:
By default, there are no error pages.That is, 401.shtml, 403.shtml etc., do not exist. The "View" link next to each file name allows you to see what a visitor sees when they encounter that type of error.
Changing the Error Pages
There are two ways to change the error pages:
From the Error Page menu, click the file name of the error page you want to edit. A text box will appear, and you can paste your HTML code into that text box.
Create the files yourself in any HTML editor and upload them to your public_html directory. The files must have the .shtml extension.
If you are still seeing the default error pages, try refreshing your browser (ctrl + F5). If you still see the default pages, please add this code to your .htaccess file in the public_html directory.
ErrorDocument 403 /403.shtml ErrorDocument 404 /404.shtml ErrorDocument 500 /500.shtml
You can even use existing pages as the resulting page. Say you don't want any visitors seeing 404 errors on your site. You can make your home page the result, like so:
ErrorDocument 404 /index.html
If Internet Explorer is not displaying the custom error page, it is likely because the error page must be larger than 1 kilobyte.
Typical Error Codes
Client Request Errors
- 400 - Bad Request
- 401 - Authorization Required
- 403 - Forbidden
- 404 - Not Found
- 405 - Method Not Allowed
- 406 - Not Acceptable (encoding)
- 407 - Proxy Authentication Required
- 408 - Request Timed Out
- 409 - Conflicting Request
- 410 - Gone
- 411 - Content Length Required
- 412 - Precondition Failed
- 413 - Request Entity Too Long
- 414 - Request URI Too Long
- 415 - Unsupported Media Type
- 500 - Internal Server Error
- 501 - Not Implemented
- 502 - Bad Gateway
- 503 - Service Unavailable
- 504 - Gateway Timeout
- 505 - HTTP Version Not Supported
Other causes for 404 Errors
- You may get 404 for images because you have Hot Link Protection turned on and the domain is not on the list.
- If you go to http://ip/~username/ and get a 404 error, one reason might be that you have incorrect coding in your .htaccess file. I recommend renaming that file to .htaccess-backup and refreshing the site to see if anything changes.
- You may also have inadvertently deleted your public_html folder, or the entire account may need to be recreated. Either way, please contact us immediately via phone or live chat so we can diagnose the problem.
2 Users Found This Useful