views:

81

answers:

2

I perfectly know how to create a custom 404 page in PHP, however I'm wondering if there's a way to give back control to to apache and let it produce the proper 404 page, sending right headers, etc. when my logic says so?

I'm looking at some apache specific functions but can't seem to find anything appropriate. Is that really just not possible? I recall something similar available to e.g. mod_perl by having full access to apache internals, where's that equivalent in PHP?

A: 

I'm not sure you can do what you want to do exactly, but one of your requirements can be met by php, and well, apart from ... I don't really see any other ones.

You can send the correct type of header using the header() function. In my code I usually use the one below.

header("HTTP/1.0 404 Not Found");
echo "sorry, page not found...";

See function.header.php in the php manual for more details.

catfarm
As I said, I'm aware of **this** solution, thanks though.
mark
I see, sorry. Perhaps clarifying more why you want apache to do it, and not using examples of things you can already do from php might help? PHP can produce a proper 404 page, so there is confusion in your request in that way. Wish I could help more, but I know of no way to return the logic back to apache without doing something dumb like header requesting to a url not handled by php.
catfarm
I wanted to take advantage of Apaches mechanism which generates additional headers for 404 pages which I would have to manually add, which I'm not fond of. Seems PHP simply doesn't support this kind of thing.
mark
A: 

My research so far led me to the conclusion that it's not possible to delegate back to Apache from within mod_php like some other technologies, e.g. mod_perl, allow.

mark