[pmwiki-users] Error pages

Patrick R. Michaud pmichaud at pobox.com
Thu Dec 28 15:33:31 CST 2006


On Wed, Dec 20, 2006 at 09:50:28AM +0100, Laurent Meister wrote:
> Hello,
> 
> is it possible to have other Error-pages like 403 for example be  
> shown in the wiki? Liki PageNotFound for 404?

If you're asking if it's possible for PmWiki to return pages
with a different result code -- yes, it's possible.  Simply
add the desired return code into the $HTTPHeaders[] array:

    $HTTPHeaders['status'] = "HTTP/1.1 403 Forbidden";

Of course, figuring out _when_ to change the headers is the real
trick, and for that I'd need to know more about what you're wanting
to accomplish.

In particular, let's suppose that you want Apache to return
PmWiki pages for various error codes.  In the apache configuration
(e.g., .htaccess), one can set:

    ErrorDocument 403 /pmwiki.php?n=Site.Forbidden

which tells apache to return the page given by 
"/pmwiki.php?n=Site.Forbidden" whenever it encounters a 
403 error.  Then to get PmWiki to return a 403 Forbidden
message for that page, place the following in 
local/Site.Forbidden.php :

    <?php
      $HTTPHeaders['status'] = "HTTP/1.1 403 Forbidden";

Pm




More information about the pmwiki-users mailing list