404 document not found

The place to discuss anything to do with computers, software, hardware, no matter how basic or technical. We all use this stuff, but we don't always understand it!
User avatar
roxytoo
Posts: 1701
Joined: Thu Feb 03, 2005 8:23 am
Location: Spain Costa Blanca

404 document not found

Post by roxytoo »

Hi I have quite a few 404 errors that I can see from my stats. Most of them are old links which have been changed when I upgraded the software. How do I find where the links are now, I must have put them on some sites but obviously when they get clicked now peeps get at 404 error!
e-richard
Posts: 5008
Joined: Sun Oct 17, 2004 11:33 am
Location: Algarve, Portugal
Contact:

Post by e-richard »

A few steps, but they are sort of technical(ish):

1. Create a file 404.html and put this into your root directory on your website (i.e. the same place that you have the index.html file).
This 404.html will display whenever your website visitor gets a 404 error, so make it pretty and friendly; something like "Sorry you have come to the wrong place, click here to see our website"

2. Then, depending on your webstats you should be able to see the referring page whenever this 404.html is displayed.

3. If you want to get really clever, you can write some code (in PHP or ASP or similar) which actually gets the referring page and writes to a log or something. This is what your webstats should already be doing, so its an alternative.
** Richard
PIMS: Holiday Rental Management system
They say we learn from our mistakes. That makes me a genius !
BarryLakes
Posts: 9
Joined: Tue Aug 16, 2011 9:14 pm
Location: Windermere

Post by BarryLakes »

roxytoo, is your website hosted on a windows server or unix?

If unix then its fairly simple, you need to create a .htaccess file within your www root directory, this redirects any errors to a custom error page. It needs to contain the following code:

Code: Select all

# Error Pages
ErrorDocument 400 /error.php
ErrorDocument 401 /error.php
ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
ErrorDocument 500 /error.php

/error.php is what I use, however it could be a .html file.

I design my sites to log all errors in a text file, including the referring website/page and referring client browser type to a text file.

With this info, I can then hook up a redirect to bounce any hits to the old page directly to the new page.

If you need any help setting this up on your web site give me a shout.
User avatar
roxytoo
Posts: 1701
Joined: Thu Feb 03, 2005 8:23 am
Location: Spain Costa Blanca

Post by roxytoo »

Thanks for the replies

Do be honest I don't know what my website is hosted on! I do have an hta access file, shall I just add the code to that?
User avatar
CSE
Posts: 4415
Joined: Mon Nov 06, 2006 3:34 pm
Location: Galicia

Post by CSE »

roxytoo wrote:Thanks for the replies

Do be honest I don't know what my website is hosted on! I do have an hta access file, shall I just add the code to that?
Well If you put a link to your website, say in your signature, we could help.
Never try to out-stubborn your guests.
BarryLakes
Posts: 9
Joined: Tue Aug 16, 2011 9:14 pm
Location: Windermere

Post by BarryLakes »

roxytoo wrote:Thanks for the replies

Do be honest I don't know what my website is hosted on! I do have an hta access file, shall I just add the code to that?
Yes if you already have a .htaccess file (which I presume is empty at the moment?) add the above code changing error.php for the error page you want to redirect your visitors too.
User avatar
roxytoo
Posts: 1701
Joined: Thu Feb 03, 2005 8:23 am
Location: Spain Costa Blanca

Post by roxytoo »

Thanks
Post Reply