Re: PHP error page not redirecting

From: Date: Mon, 10 Feb 2003 11:25:57 +0000
Subject: Re: PHP error page not redirecting
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-135038@lists.php.net to get a copy of this message
On Mon, 2003-02-10 at 11:22, Chris Hewitt wrote: > Nick Holden wrote: > > >I'm having a dispute with an ISP (surprise) about the non-functioning of > >a PHP error script. > > > >Currently, the error script is at > >http://www.touristguides.org.uk/error.php - a direct click > >on that link > >will redirect you, using: > > header("Location: > > http://www.touristguides.org.uk/index.php"); > >And sure enough, you end up at /index.php > > > >However, when I ask for /nosuchpage I get a blank window, and the > >following source is output: > ><html><body></body></html> > >And that's all. > > > >I've stripped down all the complicated stuff from the error page, and I > >can't understand why it will redirect fine if it's called directly, but > >not if it is functioning as an error page (the .htaccess has the > >necessary ErrorDocument directives in it). > > > >The ISP say "I believe the problem may lie in the fact a 404 status has > >already been sent so it nullifies the 302 redirect status. I suggest > >searching php.net for more details" - which, naturally, I have done, > >without enlightenment. > > > >But the script works nicely on another server, suggesting that it might > >be something to do with the Apache configuration. I'm rapidly getting > >out of my depth now, and would appreciate some guidance on where to turn > >next. Thanks, > > > >Nick > > > > I'm not an expert at this either, but you could test whether the > nosuchpage 404 is getting to your error.php by replacing the redirection > with some ordinary html that will display a message to you. > > At least that way you will know whether its the location header that is > the problem or not. > Hi Chris, Thanks for putting some thought to this. I did try what you suggested, and sure enough, the non-existent pages now direct to the plain html of the error.php page. So I guess the problem is related to the header() call, and not a problem getting to the error.php in the first place. Still stuck, of course... Nick

« previous php.general (#135038) next »