Re: apache not handling 404 errors for .php pages
| From: | DAve Goodrich | Date: | Thu, 12 Jul 2001 19:53:31 +0000 |
| Subject: | Re: apache not handling 404 errors for .php pages | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57636@lists.php.net to get a copy of this message | ||
on 7/12/01 12:38 PM, scott [gts] at scott@graphictype.com wrote:
> I have custom 404 error handling setup on my linux apache
> box, however, there's a problem with files that have a PHP
> extension. it seems that apache itself does not check for the
> existence of the requested .php file and fires up PHP no matter
> what. if PHP does not find the requested file, it'll bail out
> with that dorky looking "Internal Server Error" *NOT* the
> custom error handler that apache uses for non-php files....
>
> example: "notexists.html" and "notexists.php" both do not exist
>
> http://server.com/notexists.html
> will show me the custom 404 page
>
> http://server.com/notexists.php
> will show me the "Internal Server Error", becuase apache fired
> up PHP and passed in "notexists.php" without checking for the
> existence of "notexists.php" first.
>
That would be the correct response from apache.
Add this to your httpd.conf
ErrorDocument 500 /path/to/my_error_page.html
That should get you the result you want.
DAve
P.S. http://httpd.apache.org/docs/custom-error.html.html
> A possible solution that comes to mind is to auto_prepend
> a script that will check for the existance of the file
> that PHP is attempting to execute, and die gracefully if
> it does not exist on the server.... but that would be a bad
> kludge hack (if it even works at all)
>
> anyone have a more elegant solution?
--
Dave Goodrich
Director of Interface Development
Reality Based Learning Company
9521 NE Willows Road, Suite 100
Redmond, WA 98052
Toll Free 1-877-869-6603 ext. 237
Fax (425) 558-5655
daveg@rblc.com
http://www.rblc.com