Forum Moderators: open
I've set up custom error pages and receive email notification when an error is generated which is working like a treat. The error page emails me the requested page and the referring url.
My problem is that the majority of error emails i receive are for images that have been removed and there is no referring url.
I've set up several 301 redirects for the pages that were being requested but would prefer not to have to do the same for all of the old images as there would be hundreds.
Thanks in advance
So what do you want to achieve?
To receive less e-mails?
You could change your custom error page so that if the request is for an image, and there isn't a referrer, don't send an e-mail.
To have less 404 errors in your log?
You could try adding disallows for the old images into your robots.txt, of course this is only practical you don't have to specify each one individually.
To get the people to come to your new page?
For the most commonly requested images that no longer exist, create another image with the same name, that has some text in it of the form "sorry that image no longer exists, please visit http://www.example.com/page.htm to see the new images"
[Edit to fix some spelling mistakes]
[edited by: Dijkgraaf at 6:22 am (utc) on Sep. 7, 2005]
I'm using a php script to report the errors via email which defines the two variables as below.
$referring_url = $_SERVER['HTTP_REFERER'];
$requested_url = $_SERVER["REQUEST_URI"];
I assumed that the 'referrer' would be recorded in all cases except for spiders? which would sort themselves out after a little while as the spiders crawl the site and re-index it correctly.
The images in question are incidental... background images, spacers, etc... not product images / logos / avatars, etc.
I was originally wanting to stop the email if the error was generated for an image however that would also pose problems if legitimate links to images are broken.
Have to think about what solution will best suit?
Post back tomorrow.
404 errors are such a pain to deal with, as there are minor SE's out there that still try to call 3 year old pages (I know from experience). You're probably better off just storing the errors in a database, and viewing the log via web page. You can set up the page to delete the errors from the database when you're done too.
I also send myself text messages to my phone, but only if a 500 error occurs. They are so rare now that it doesn't bother me when I get one. I still log all my 404s and 500s to a database though, and delete them when I'm finished looking at them.