Hi all... I hope this is the right forum to ask for help Anyway, I am trying to redirect surfers from a not-found page to the homepage. How do I do it, and is the best way to handle this situation? I mean - Is it better to display a nice 404 page or to redirect them to the homepage? Thanks in advance , Guy.
It's always a Good Thing® to use expected behavior. So give them your custom 404 page that tells them what the error is and suggests a way out. Here is one I use on my privates sites. <!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, 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 “404 file not found” error.</p> <p>Try looking at the <a href= "/webdev/">webdev index</a> page to find the file you wanted.</p> <!-- add a leading / to the path for use on garyblue.port5.com --> <p>--g</p> <hr /> <p id="footer">©2005-06 Gary Turner</p> </div><!-- end inner" --> </div><!-- end cell --> </div><!-- end wrapper --> </body> </html> Code (markup): cheers, gary