Creating Error Documents For Server Errors |
|
| Htaccess |
| Saturday, 23 June 2007 16:49 |
Web Site Error DocumentsMany times and SEO expert must know how to tweak .htaccess file. I must say it is essential to know how to do different redirects, tweaks, setting the error documents etc. The error documents can be set in the .htaccess file that we talked earlier about. First lets take a look of the list of the server returned error codes after that we will tweak our .htaccess file. Successful Client Requests200 OK201 Created 202 Accepted 203 Non-Authorative Information 204 No Content 205 Reset Content 206 Partial Content Client Request Redirected300 Multiple Choices301 Moved Permanently 302 Moved Temporarily 303 See Other 304 Not Modified 305 Use Proxy Client Request Errors400 Bad Request401 Authorization Required 402 Payment Required (not used yet) 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 Server Errors500 Internal Server Error501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 505 HTTP Version Not Supported For example an Error Document for the error code 200 would cause our site to loop endlessly whenever a page was found well we do not want that. We would probably only need to create documents for the server error code 404 and 500, 400 means that the page cant be found and we need to create a document for that error where we can point the users to the homepage for example. 500 error document would help when our site gets internal server errors in any scripts that are running on our site. Also we can setup the error page for the 401 - Authorization Required (when a visitor tries to enter the protected area without the proper password etc), 403 - Forbidden (where the file with permissions is not allowed to be accessed by the user) and error 400 - Bad Request, that is displayed when the users tries to do some strange things with our site URL or the scripts we are having on the site. To setup these error documents you simply need to add the following lines in your .htaccess file:
ErrorDocument code /directory/filename.ext
or ErrorDocument 401 /errors/notfound.html In case a user gets an 401 error he is automatically forwarded to the page yourdomain.com/errors/401notfound.html Another example: ErrorDocument 500 /errors/500internalerror.html You can simply select the name of your error pages and upload them to the correct directory or to the root of your server. Usually the webmaster keep the error documents in the root of your server. But you can move them to the directory. In that case you have to specify the correct path for each error document in the .htaccess file. In this exmple the error documents are in the folder errors. For example the .htaccess could look like this
ErrorDocument 400 /errors/badrequest400.html
ErrorDocument 401 /errors/authreqd401.html ErrorDocument 403 /errors/forbid403.html ErrorDocument 404 /errors/notfound404.html ErrorDocument 500 /errors/server500.html |
We ordered 500 images retouching pack...
Guys from Seoandwebdesign.com did ast...
Your retouching was great, we will or...
We ordered 500 images retouching pack...
Drupal isn't the problem, it's the da...
Drupal definately rocks, yes if you l...
just build your own framework and cms...
I did not twitter this post, I was re...
Then why twitter this now? That was ...
Well that was 2 years ago, now Drupal...
1. "Their Forum is super slow, I ...
Many costumers really loved this dvd,...
why? Explain in more details please
Zane Durant from www.renoseo.com, www...
you can check our jewelry gallery for...