Custom Error Pages with .htacess
Published on: 2005-08-15 - Views: 2125
Surfing the net you'll have surely bumped into the old 404 Not Found error page.
It's not so pleasant an no webmaster would like to show that error to his visitors.
There's a simple, fast solution to it: .htaccess
This file is located in your website root folder (or if you haven't it there you can create it and place it there).
If your Operative System doesn't let you name the file .htaccess you can name it htaccess.txt and rename it to .htaccess once it's on the server. It's fundmental that it's named ".htaccess" with the starting dot as it means that the file is hidden in unix systems
This tutorial applies to those sites running on Unix Servers with Apache Webserver.
Your .htaccess file will have to contain the following line, customized for each error you want it to manage.
ErrorDocument 404 http://www.yourdomain.com/yourfolder/yourerrorpage.html
It's important that all the code, for each error page, is on the same line. You can even use a local path instead of the absolute including http://www....... so your code would be:ErrorDocument 404 /yourfolder/yourerrorpage.html
Why should you do this all? Well....your visitors will be shown a custom error page, and not a rude Server Message...take care of your visitors ;)
