Best practice forum (Archived)

Error pages redirecting to 404

 
? ?
Error pages redirecting to 404
by ? ? - Thursday, 12 January 2012, 2:23 AM
 

Hi,
We have a problem on client production server

for some of the errors the server redirect to 404 page

for example when admin try to register user to F2F activity and occur an error for the mailing process the user redirect to 404

Any idea what can cause such behavior?

the client infrastracture is :
OS-  MS server 2008 
DB - MSSQL 2008
Web server - IIS7
php - 5.2

Thanks,

Rafi

Simon Coggins
Re: Error pages redirecting to 404
by Simon Coggins - Thursday, 12 January 2012, 1:29 PM
Group Totara

Hi Rafi,

When moodle prints an error page, it sets the header to return a status code of 404. This can be picked up by some servers or proxies and rewritten to display a custom 404 page, rather than the moodle error page.

I'm not exactly sure why moodle chooses to set the 404 error, it seems wrong to me but I'm hesitant to change it as there is probably a good reason.

The best approach would probably be to look at your server configuration and turn off whatever is rewriting the 404 requests. Alternatively have a look at the print_error() function in lib/weblib.php and try modifying the line which sets the header (L5844).

Simon

? ?
Re: Error pages redirecting to 404
by ? ? - Tuesday, 17 January 2012, 1:42 PM
 

Hi Simon,


Thanks for the info.

For now I modified the line which sets the header in  lib/weblib.php
there is also the error() function in lib/deprecatedlib.php that sets the header  (L1642)


Rafi