So I finally decide to polish up my website and blog, changed banner and everything,but the default “404 Error File Not Found” page is still as ugly as ever .

So I did some search on the internet and marked around with the 404.shtml file under the host server(I use hostmonster), opened the file saw some code like

<!– SHTML Wrapper – 404 Not Found –>

<!–#exec cgi=”/cgi-sys/fourohfour.cgi” –>

I had no experience of dealing with shtml before so I deleted first line then the second line and changed it to html code instead

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
</head>
<body background=”http://yebbs.org/bodybg.gif”>
<h1>&nbsp;</h1>
<h1>404 Error File Not Found</h1>
<h2>The page you are looking for might have been removed, <br />
had it’s name changed, or is temporarily unavailable.</h2>
<p>If you typed in the URL, please check the spelling</p>
<p>You can try to click the Back button and try another link</p>
<p>&nbsp;</p>
<p><a href=”http://yebbs.org/yebluenote”>Ye’s Blue Note</a></p>
</body>
</html>

Problem: Background doesn’t show up

Then I found the background image didn’t show up. so the whole page was practically blank with the white text.

I thought the server runs shtml differently from html.

Later I found this is because error page doesn’t look for something like ./bodybg.gif

which means, if you are at http://yebbs.org/filedoesn’texitpage  it shows background if you upload the background file under root directory

but if you do http://yebbs.org/yebluenote/filedoesn’texitpage it won’t show up because the server looked for the background file under root/yebluenote/ directory and the file didn’t exit.

To save trouble of upload background image to every directory that exit, replace the relative path(./bodybg.gif) with absolute path(http://yebbs.org/bodybg.gif).

Option one

So I looked up the internet, found a way to point the error page to any html you want.

Basically, open .htaccess file under server, if didn’t exit, create one.

paste something like

ErrorDocument 404 /404.html

ErrorDocument 404 is for”404 page not found”, 404.html is what ever name for your 404 error page.

Then create 404.html(something like the html code I had above) , put whatever you want in there.

Upload and type something doesn’t exit  under your domain name, in this case something like http://yebbs.org/dfiouioduo , you’ll see the error page has changed.


Option two

Change shtml file, find 404.shtml under server, delete everything and paste any html address and it works.