PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 8th, 2003, 05:01 PM
pflieger pflieger is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 20 pflieger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Is there a way to log the bad URL request?

Reply With Quote
  #2  
Old September 8th, 2003, 05:23 PM
trevHCS trevHCS is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 80 trevHCS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
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...

Trev

Reply With Quote
  #3  
Old September 8th, 2003, 05:23 PM
djl's Avatar
djl djl is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: London, UK.
Posts: 469 djl User rank is Private First Class (20 - 50 Reputation Level)djl User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 29 m
Reputation Power: 10
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

Reply With Quote
  #4  
Old September 8th, 2003, 08:48 PM
pflieger pflieger is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 20 pflieger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 18 sec
Reputation Power: 0
Thanks guys. It was so obvious! The $_SERVER['REQUEST_URI'] variable has the info I needed. I was relying on HTTP_REFERRER before.

Reply With Quote
  #5  
Old September 9th, 2003, 12:17 AM
Stink Sleeve's Avatar
Stink Sleeve Stink Sleeve is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2003
Location: New Hampshire, USA
Posts: 550 Stink Sleeve User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 17 m 26 sec
Reputation Power: 7
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.
__________________
Download Mozilla Firefox Now!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > 404 Diagnosis


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 9 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek