how to handle 404 error in a website?

Recommended Answers

.htaccess error message

ErrorDocument 404 /notfound.htm

a single line of text in the .htaccess file
directing to a html/php/asp/whatever page

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta name="Language" content="en-US">
<meta http-equiv="content-Script-Type" content="text/javascript">
<title>Oops File Not Found</title></head>
<body style='margin:70px;'><p>MYSITE</p>
<a …
Jump to Post

All 3 Replies

.htaccess error message

ErrorDocument 404 /notfound.htm

a single line of text in the .htaccess file
directing to a html/php/asp/whatever page

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta name="Language" content="en-US">
<meta http-equiv="content-Script-Type" content="text/javascript">
<title>Oops File Not Found</title></head>
<body style='margin:70px;'><p>MYSITE</p>
<a href='http://www.mysite.com'>©Mysite</a>
<p>Oops:<br>
File not found<br>
The requested resource or page is not available<br>
or<br>
Direct linking to this page is not available.<br><br>
<p><ahref="http://www.mysite.com/">Click here</a> to open MYSITE menu pages</p>
</body></html>

or

ErrorDocument 404 "<body bgcolor=#ffffff><h1>That page dont acutally <b>Exist</b>, Colonel!"

ErrorDocument 404 SNIP

I put this code in .htaccess file.

create a page 404NotFound.html and uploaded it to server.


is it enough or should i rediret the "404NotFound.html"
page to anywhere?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.