Re: 404 error

From: Date: Mon, 24 Sep 2001 10:33:55 +0000
Subject: Re: 404 error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68500@lists.php.net to get a copy of this message
You need to create an .htaccess file with this inside of it: ErrorDocument 404 /yourfulldirectory/404.php What this does is tells your server where to look when it has a 404 error. You can put an .htaccess file in each directory so each directory will have a different 404 error. Or you can put it in the root "/404.php" since the file is recursive within directories. And then I have inside my 404.php file a little script that emails me the referrer page and the link that created the error, plus a little to tell the user that the page was not found of course :) The Page with error is $HTTP_REFERER The Link on that Page is $REDIRECT_SCRIPT_URI I hope that helps! Rick > But if the file has an extension that you have told Apache to associate with > PHP, it gets sent to the parser before Apache checks to see if it exists. > The paresr then sends back an html page with the error on, so Apache thinks > it has found the page. At least that's what happens on our server. Am I > missing something in Apache that will tell the server to check a file exits > before it sends the request to the server? > > > Tim Ward > Senior Systems Engineer > > Please refer to the following disclaimer in respect of this message: > http://www.stivesdirect.com/e-mail-disclaimer.html > > >> -----Original Message----- >> From: Christian Reiniger [SMTP:creinig@mayn.de] >> Sent: Monday, September 24, 2001 11:10 AM >> To: Tim Ward >> Cc: PHP General >> Subject: Re: [PHP] 404 error >> >> On Monday 24 September 2001 10:08, Tim Ward wrote: >>> But how did you get the PHP code to run if the file doesn't exist? If a >>> file with a php extension is requested Apache thinks the error returned >>> by the PHP parser is a valid response to the request and auto_prepend >>> only seems to work after the parser has got the file for parsing. >> >> Simple :) >> You tell apache to serve, say, 404.php on a 404, and in *that* file you >> place the code :) >> >> If you want to send a 404 from an existing php file, do a >> >> header ('HTTP/1.0 404 Not Found'); >> include ("404.php"); >> exit (); >> >> >> -- >> Christian Reiniger >> LGDC Webmaster (http://lgdc.sunsite.dk/) >> >> Results 1 - 10 of about 201,000,000. Search took 0.08 seconds >> >> - http://www.google.com/search?q=e > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#68500) next »