Forum Moderators: phranque

Message Too Old, No Replies

404 error pages how do I......

         

companyone

8:10 pm on Aug 19, 2004 (gmt 0)

10+ Year Member



Hi,

Can some please explain how I set it up to so old pages that are already index that are getting a 404 error now...go to say my home page instead.

Please give instuctions in the most basic terms.

Thanks for yoour replys in advance.

Dan

MattyMoose

9:14 pm on Aug 19, 2004 (gmt 0)

10+ Year Member



What you need to do is add an "errorDocument Handler" in Apache in your VirtualHost like so:

ErrorDocument 404 /404.php

This tells Apache that when it encounters a 404, it will load this file as the text of the 404 message. Note that the path is relative to the DocumentRoot. So, if your DocumentRoot is /home/www/html, then the 404 file needs to be at "/home/www/html/404.php"

In the PHP/HTML file, include a meta-refresh tag:
<META http-equiv="refresh" content="7; URL=http://www.mysite.com/index.php">

You could also make the 404 page your Index page (ie: /index.php), but I'm not sure what the implications of that would be.

There may be better ways to do it as well, with mod_Rewrite and so on.

HTH!
-MM

bumpaw

11:05 am on Aug 20, 2004 (gmt 0)

10+ Year Member



There may be better ways to do it as well, with mod_Rewrite and so on.

With mod_Rewrite you can point old calendar.htm to new calendar.php or index.html. Your host tech support should be able to guide you on this one if you don't want to write the file yourself.