Re: Capturing 404s with PHP, slight twist

From: Date: Fri, 23 May 2003 16:19:47 +0000
Subject: Re: Capturing 404s with PHP, slight twist
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-148793@lists.php.net to get a copy of this message
Wel I removed the ?code=XXX and changed added the $_SERVER['REDIRECT_STATUS'] and it worked. Thanks very much Ernest! Jeff ----- Original Message ----- From: "Ernest E Vogelsinger" <ernest@vogelsinger.at> To: "Jeff Lewis" <jeff@hyrum.net> Cc: <php-general@lists.php.net> Sent: Friday, May 23, 2003 11:51 AM Subject: Re: [PHP] Capturing 404s with PHP, slight twist > At 17:23 23.05.2003, Jeff Lewis said: > --------------------[snip]-------------------- > >The full htaccess is as follows: > > > >ErrorDocument 400 /errors.php?code=400 > >ErrorDocument 401 /errors.php?code=401 > >ErrorDocument 403 /errors.php?code=403 > >ErrorDocument 404 /errors.php?code=404 > >ErrorDocument 500 /errors.php?code=500 > > > >Here is the image src tag: > > > ><img src="Jason_Larue.bmp" width=90> > --------------------[snip]-------------------- > > You don't need the error code in the URL - maybe this is why the > appropriate $_SERVER entries are missing. You can always find the error > code in REDIRECT_STATUS. > > This always works for me: > > -- .htaccess -- > ErrorDocument 403 /errors.php > ErrorDocument 404 /errors.php > ErrorDocument 500 /errors.php > > -- errors.php -- > > switch ($_SERVER['REDIRECT_STATUS']) { > case 403: > handle_403_error(); > break; > case 404: > handle_404_error(); > break; > case 403: > handle_505_error(); > break; > default: > handle_any_other_error(); > } > > > > > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ > > > >

« previous php.general (#148793) next »