Discuss 404 Diagnosis in the PHP Development forum on Dev Shed. 404 Diagnosis PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month! Download and Activate to enter!
Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.
Posts: 20
Time spent in forums: 48 m 18 sec
Reputation Power: 0
404 Diagnosis
My site log shows a lot of recent hits to my 404 page. Problem is, I can't figure out the erroneous link/URL. I log the referring page, but that doesn't help.
If I enter 'www.mydomain/bad_request.php', I get redirected to 404.php and my log shows a hit to 404.php. The requested URL is not known.
Posts: 80
Time spent in forums: < 1 sec
Reputation Power: 10
What web server are you using? I'm guessing Apache 1.3?
Do you actually get redirected to 404.php, as in does that show in the browser address bar or does it just show the contents of the 404.php page?
If it redirects to 404.php properly then you could put some scripting into there to log the referrer, ie:
$_SERVER['HTTP_REFERER']
....which I'd guess should show up and write that to a text file or database.
If it doesn't redirect properly, maybe try collecting the value of $_SERVER['REQUEST_URI'] and logging that.
If those don't work, try adding phpinfo() to the 404.php, create an error404 and see if this name appears anywhere in the output which should give you a clue as to what you should be looking at collecting. Remember to remove it really quickly however as it probably poses a security risk.
On ours if logs the actual page which it couldn't find, but I don't understand it enough to know how it does that...
Posts: 469
Time spent in forums: 10 h 29 m
Reputation Power: 12
I remember var dumping the $_SERVER var on one of my error pages once and noticing that there was something called $_SERVER['REDIRECT_ERROR_NOTES'].
I'm not too sure if this works anymore or not, but you could set that up to be emailed to you every time a 404 is encountered
Posts: 550
Time spent in forums: 11 h 17 m 26 sec
Reputation Power: 9
A side note about 'HTTP_REFERRER'.
If this is from Dreamweaver MX then it auto-completes this incorrectly.
It adds an extra r in 'referrer'. It should only be 'HTTP_REFERER'.
I nearly killed myself one night trying to figure out why this wasn't
working for me when I upgraded to Dreamweaver MX. Turns out
someone misspelled it in production.