CGI: set up goto hook so that /ikiwiki.cgi?do=goto can be an Apache ErrorDocument
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sat, 31 Jan 2009 18:09:24 +0000 (18:09 +0000)
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sat, 31 Jan 2009 18:09:24 +0000 (18:09 +0000)
IkiWiki/CGI.pm

index 82cad40c80ad92961fb88e1717f9d0f06049af9e..7e968d966455c06eb2749252c2cd639c6a17acc5 100644 (file)
@@ -403,7 +403,14 @@ sub cgi (;$$) {
        # commenter are for compatibility with any saved URLs
        if ($do eq 'goto' || $do eq 'recentchanges_link' ||
            $do eq 'commenter') {
-               cgi_goto($q);
+               my $page = undef;
+
+               if ($ENV{REDIRECT_STATUS} eq '404') {
+                       $page = cgi_page_from_404($ENV{REDIRECT_URL},
+                               $config{url}, $config{usedirs});
+               }
+
+               cgi_goto($q, $page);
        }
 
        # Need to lock the wiki before getting a session.