if (! ($r->uri =~ / special patterns go here /)) { $m->redirect('/page-not-found-error.html?p=' .uri_escape($r->uri)); } #### ErrorDocument 404 /page-not-found-error.html #### % my $page = uri_unescape($p) || $ENV{REDIRECT_URL}; You were looking for <% $page %> and the server can't find it. #### if ($new) { # from http://www.masonhq.com/?FAQ:HTTPAndHTML $m->clear_buffer; $r->method('GET'); $r->headers_in->unset('Content-length'); $r->content_type('text/html'); $r->header_out('Location' => $new); $m->abort(301); } #### Not Found The requested URL /login/advanced was not found on this server. Additionally, a 301 Moved Permanently error was encountered while trying to use an ErrorDocument to handle the request. #### $m->clear_buffer; $r->method('GET'); $r->headers_in->unset('Content-length'); $r->content_type('text/html'); $r->header_out('Location' => $new); $m->abort(301); #### The requested URL /login/advanced was not found on this server. Additionally, a 301 Moved Permanently error was encountered while trying to use an ErrorDocument to handle the request.