Bad Credit Mortgages - Mobile Phones - Mortgages - Loans - Mortgage

PDA

View Full Version : 404 Error Script


theultimatepublishing
Sep 28th 2006, 7:33 pm
Everytime when someone types in a wrong url, (eg. they typed in a url with .htm when the url is acutally .html, or they misspelt something), they'll be sent to a 404 error page.

How do I create a customized 404 page? Just like marketingtips website.

jrlane7
Sep 28th 2006, 10:00 pm
Most webhosts allow you to create custom error pages. I would check out your webhost FAQ. My webhost has a link on the control panel with step by step instructions on how to do this.

Rick Lane

kk5st
Sep 28th 2006, 11:13 pm
Assuming Apache is your web server, in httpd.conf or in an .htaccess file (http://httpd.apache.org/docs/1.3/mod/core.html#errordocument), set
ErrorDocument 404 /path/my404.html where my404.html is a regular html document that says what you want your 404 error doc to say. My personal site has this 404 page;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator"
content=
"HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org" />

<title>404 Error | Gary Turner | web development sandbox</title>

<style type="text/css">
/*<![CDATA[*/

html, body {
height: 100%;
margin: 0;
padding: 0;
}

body {
font: 100% verdana, helvetica, sans-serif;
background-color: #f8f8f8;
color: #222;
}

p {
font-size: 1em;
}

h1 {
font: 1.5em georgia, geneva, serif;
text-align: center;
}

#wrapper {
display: table;
height: 100%;
width: 100%;
}

#cell {
display: table-cell;
vertical-align: middle;
}

#inner {
position: relative;
margin: 0 auto;
border: 2px solid black;
-moz-border-radius: 16px;
padding: 0 10px;
width: 75%;
}

#footer {
text-align: right;
}

/*]]>*/
</style>
</head>

<body>
<div id="wrapper">
<div id="cell">
<div id="inner">
<h1>Oops! There's been a mistake</h1>
<p>This is known as a &ldquo;404 file not found&rdquo; error.</p>

<p>Try looking at the <a href=
"/webdev/">webdev index</a> page to find the file you wanted.</p>

<p>--g</p>
<hr />

<p id="footer">©2005-06 Gary Turner</p>

</div><!-- end inner" -->
</div><!-- end cell -->
</div><!-- end wrapper -->
</body>
</html>
cheers,

gary

LongHaul
Sep 29th 2006, 1:36 am
I've had what seems like a sudden spike in my custom 404 page being accessed. But I can't figure out what page is referring to it. (The "Referer" field on my recent visitors page is invariably blank.)

Is there a way to find this out? Or is this a question for my host (hostgator)?

It seems to often come from a user who only loads a single page. If I had an affiliate link messed up, or a broken image, would the 404.html page show as having been loaded?