httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Peacock" <richard.peac...@minorplanet.com>
Subject RE: [users@httpd] Handling 404 errors
Date Wed, 26 Aug 2009 12:21:25 GMT
From: Andrew Hole [mailto:andremailinglist@gmail.com] 
Sent: 26 August 2009 12:24
To: users@httpd.apache.org
Subject: [users@httpd] Handling 404 errors

 

Hi guys!

Actually our web application has a retry mechanism based on http status
code returned to client. Just an example:
- An http request is made to http://web/software_A_folder/file.swf
- if the file doesn't exist (http 404) on software_A_folder, the request
is made in core folder: http://web/core/file.swf

This mechanism is used on entire application: when a file doesn't exist
on software_x_folder, a retry is made on core folder.

In terms of Apache, this mechanism make always 2 requests (in case of
file not found).

What I want to know is if there are any option on Apache to handle 404
status code without retry the request. When file not found, some logic
will handle the 404 and return the file located on other folder.

I appreciate your help.

Best Regards,
A.

 

 

 

I am not sure if this would work or be what you're after as I can't test
this right now but you could point the 404 error to a PHP page which
grabs the requested URI/L and creates a re-direct to the alternative
page. Edit httpd.conf to have the line:-

 

ErrorDocument 404 /errordocs/404error.php

 

The php page would be something like:-

 

<html><META http-equiv='refresh'
content='1;URL=http://www.example.com/core/$_SERVER["REQUEST_URI"]'></ht
ml>

 

Thinking about it, I really don't know if that would work - I've a
feeling that it would simply try to load /core/404error.php (which won't
be found, thus producing another 404 error lol!).  I also think that
two, perhaps three, requests would ultimately be made (page_a -->
error.php --> page_b). Darn, sorry, this might not be much of a solution
afterall! But it might help so will submit it none-the-less.

 

Good luck! It would sure be interesting to know if you find a solution
and what it is!

 




**********************************************************************
Privileged/Confidential Information may be contained in this 
message. If you are not the addressee indicated in this 
message (or responsible for delivery of the message to such 
person), you must not copy, distribute or take any action in 
reliance to it.
In such case, you should destroy this message and kindly 
notify the sender by reply email. Please advise immediately 
if you or your employer do not consent to Internet email for 
messages of this kind. Opinions, conclusions and other 
information in this message that do not relate to the official 
business of Minorplanet Systems plc shall be understood as 
neither given nor endorsed by it. Minorplanet Systems plc, Registration no: 3372097
Minorplanet Limited, Registration no: 4072786
Greenwich House, 223 North Street, Leeds, LS7 2AA
VAT #: 698 1438 86
********************************************************************** 
 
Mime
View raw message