Forum OpenACS Q&A: Re: Error pages and Host Node Mapping

Posted by Ryan Gallimore on
In the config file:

ns_section "ns/server/${server}/redirects"
ns_param 404 "global/file-not-found.adp"

You must use an ADP file. You cannot use a tcl/adp pair so, any tcl code must be embedded in the ADP.


rp_internal_redirect /www/global/404

Note in order to use the templating system, we have to invoke the request processor. We call ns_adp_abort to avoid a tcl exception about closing the connection before the adp buffer is flushed.



<h1>Sorry, page not found</h1>

The master tag will template the page contextually, so if a file is not found in the main site, the main site theme will be used, if a file is not found in a subsite (or host node map), the subsite theme will be used.

The only remaining issue is that with this solution, a 404 response code is not actually returned.