[kwlug disc.] custom 404 message

John Van Ostrand john at netdirect.ca
Sat Dec 30 08:16:42 EST 2006


On Sat, 2006-12-30 at 00:11 -0500, Chris Bruner wrote:
> I'm trying to create a custom php error message, and from what I've 
> read, the proper way to do this is create an .htaccess file containing:
> ErrorDocument 404 missing.php
> 
> where missing.php is my custom message.
> 
> When I do this, the page comes back with the text
> missing.php
> 
> This happens whether it's php or html.
> 
> Does anyone know how to get apache to actually send back the page 
> instead of just displaying the name of it?

The ErrorDocument can return simple text which is how your example has
it configured. To have it send back a page put a leading slash in the
file name (relative to DocumentRoot) or use a full URL. E.g.

ErrorDocument 404 /missing.php

   --or--

ErrorDocument 404 http://www.mysite.com/missing.php

See http://httpd.apache.org/docs/2.2/mod/core.html#errordocument

-- 
John Van Ostrand                     Net Direct Inc.
CTO, co-CEO                 564 Weber St. N. Unit 12
                                Waterloo, ON N2L 5C6
john at netdirect.ca                   ph: 518-883-1172 x5102
Linux Solutions / IBM Hardware      fx: 519-883-8533



More information about the KWLUG-Disc mailing list