by Howard B. Richman
This simple correction quickly guides your customers to the desired page, avoiding the File Not Found message. If you’ve ever encountered the those terrible 404 ErrorDocument or File Not Found messages while trying to access a web page, you know how frustrating and unhelpful they are. Usually that’s the end of it and you give up and move on to the next site. This is probably what’s happening to your potential visitors and customers when they make the slightest error in typing. But actually, with the creation of a simple custom error page, you can easily prevent this from happening.
Here’s where you can learn about file not found error document messages. We all hate the custom error pages on requested url and requested address. It displays in window tutorials so you always display attempted url. Get no more 404 error pages with this free information. Our free tips and free information explains how-to with books or how-to publications. These custom 404 ErrorDocument solutions are the secrets. They are your tools and remains displayed in window.
“Very helpful. I already knew this information, but it explained it better than I have seen anywhere else. Thank you for your efforts.”
—Tony Morgan,
http://siquo.cjb.net
What Causes the Errors?
- Someone may have typed the slightest mistake in the URL.
- Someone may have clicked on an outdated or incorrect link.
Why Do You Need A Custom Error Message?
When someone gets the generic error message, they will go away and never come back. You will lose visitors and potential customers. It will appear to them that you are not in business.
Generic or Custom?
If you don’t create a custom error page, the server where your website is hosted will default to something like this:
File Not Found
The requested url /xxxx/xxxxx.htm
was not found on this server.
The above has many variations, including “404 ErrorDocument.” They are all equally useless and unhelpful. Wouldn’t you rather that your visitors see something like this:
This allows visitors to navigate their way around to find what they were actually looking for.
Requirements.
- You own the domain name and maintain the site.
- Your site is posted on a UNIX server. (For NT servers, the following information was provided by Ram Papatla of Microsoft and may be helpful: “The default 404 file is at C:\WINNT\help\iisHelp\common\404b.htm. You can just modify that, or create a new file and change the custom error properties in IIS to point to the new file.” (If you are not sure what type of server your site is hosted on, you can check here.)
- You have Telnet or FTP access. If you don’t have an FTP program, we recommend this free program from Filezilla for Windows, Mac or Linux.
Here’s How To Do It.
Please note: Elements in red bold should be replaced with your customizations.
1) Create A Special HTML Page Just for Errors. Use the “Custom Error Message Example” above to get ideas for writing your own message. Assign a URL to it like:
http://www.YOURDOMAIN.com/not_found/index.htm
and upload it to your site. (You can name it whatever you want and place it wherever you want on your site).
2) Create a .htaccess file. This is a hidden file that you place in your root directory. This is what directs users to the custom error page, when they type in a wrong URL. It is an ASCII text document. This file affects the directory and all sub-directories in which it is placed. Since you want it to affect your whole site, we place it in the root directory. If you already have a .htaccess file in your root directory, then don’t create a new one. Just add the following line to it. The format is:
ErrorDocument error-code error-page.
It is crucial that the E and D are capitalized and that there is a space before and after the 404. It must be typed all on one line. The URL can be relative or absolute.
Absolute URL example:
ErrorDocument 404 http://www.YOURDOMAIN.com/not_found/index.htm
Relative URL example:
ErrorDocument 404 /not_found/index.htm
I suggest that you use the relative URL. This way, should the visitor ever get to your error page, the address window of their browser will continue to display the attempted URL of what they just typed or clicked-on (instead of the URL of the error page). This allows them to see what they did wrong, so they can correct it.
Now save the file. Windows does not allow you to save a file beginning with a “.” So just save it as “htaccess.txt” and change the name remotely after you FTP it.
Upload the file to the root directory on your site using your FTP program. (You must use in ASCII mode for this or it won’t work!)
Now, remotely change the name of the file to “.htaccess”
Finally, you must now use the CHMOD command through your FTP program or Telnet to set the permissions to CHMOD 755. Click here on more info on CHMOD.
A Point About The Links On Your Error Page.
Although I recommend using “relative” links, as indicated above, for the .htaccess file, all links on your actual error page should be absolute or “global.” This is because in some cases, the server references the error page as if it were the root directory and then any images or links on that page will not work!
For example…
<img src=”http://www.YOURDOMAIN.com/images/my_image.gif”>
Not by using relative links like this:
<img src=”/images/my_image.gif”>
How It Works.
When a user tries to find a page that does not exist, the server finds that it was not there. It then checks the .htaccsss file for help. The special line redirects the server to the assigned page.
Addendum
Many people are using WordPress lately to make their site instead of using an html editor. So this means that your THEME may have some provision where you can very easily update your custom error page. If that is the case, then the above instructions may not be necessary!