well, this might not be what you're lookin for, but i did this in apache:
ErrorDocument 404 http://myserver.com/error.php?num=404
and for 403, i did the same:
ErrorDocument 403 http://myserver.com/error.php?num=404
i have the script handle 403's and 404's the same, so the pesky user won't know when he's hit an off-limits dir - but if you find a way to do this w/o an apache setting, PLEASE lemme know!
thanks,
blake