Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 787501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:12:44+00:00 2026-05-14T21:12:44+00:00

Based on this documentation , I’ve implemented a catch all route which routes to

  • 0

Based on this documentation, I’ve implemented a catch all route which routes to an error page.

Here is the last route in my bootstrap.php

Route::set('default', '<path>', array('path' => '.+'))
    ->defaults(array(
        'controller' => 'errors',
        'action'     => '404',
    ));

However I keep getting this exception thrown when I try and go to a non existent page

Kohana_Exception [ 0 ]: Required route
parameter not passed: path

If I make the <path> segment optional (i.e. wrap it in parenthesis) then it just seems to load the home route, which is…

Route::set('home', '')
    ->defaults(array(
        'controller' => 'home',
        'action'     => 'index',
    ));

The home route is defined first.

I execute my main request like so

$request = Request::instance();


try {

    // Attempt to execute the response
    $request->execute();

} catch (Exception $e) {


   if (Kohana::$environment === Kohana::DEVELOPMENT) throw $e;

    // Log the error
    Kohana::$log->add(Kohana::ERROR, Kohana::exception_text($e));

    // Create a 404 response
    $request->status = 404;
    $request->response = Request::factory(Route::get('default')->uri())->execute();

}

$request->send_headers();
echo $request->response;

This means that the 404 header is sent to the browser, but I assumed by sending the request to the capture all route then it should show the 404 error set up in my errors controller.

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Errors extends Controller_Base {

    public function before() {
        parent::before();
    }

    public function action_404() {


        $this->bodyClass[] = '404';

        $this->internalView = View::factory('internal/not_found');

        $longTitle = 'Page Not Found';

        $this->titlePrefix = $longTitle;


    }
}

Why won’t it show my 404 error page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:12:44+00:00Added an answer on May 14, 2026 at 9:12 pm

    For my projects I never specified any specific separated route for 404. I just catch exceptions thrown by routing, when no appropriate route was found.

    Here is how I am handling all kind of exceptions that I’ve discovered in Kohana. I hope it will help you.

    try
    {
        try
        {
            $request = Request::instance();
            $request->execute();
        }
        catch (ReflectionException $e)
        {
            Kohana::$log->add(Kohana::ERROR_404, Kohana::exception_text($e));
    
            if (!IN_PRODUCTION)
            {
            throw $e;
            }
    
            $request->response = Request::factory('err/404')->execute();
        }
        catch (Exception404 $e)
        {
            Kohana::$log->add(Kohana::ERROR_404, Kohana::exception_text($e));
    
            if (!IN_PRODUCTION)
            {
            throw $e;
            }
    
            $request->response = Request::factory('err/404')->execute();
        }
        catch (Kohana_Request_Exception $e)
        {
            Kohana::$log->add(Kohana::ERROR_404, Kohana::exception_text($e));
    
            if (!IN_PRODUCTION)
            {
            throw $e;
            }
    
            header('Content-Type: text/html; charset='.Kohana::$charset, TRUE, 404);
            echo Request::factory('err/404')->send_headers()->execute()->response;
            exit;
        }
        catch (exception $e)
        {
            Kohana::$log->add(Kohana::ERROR, Kohana::exception_text($e));
    
            if (!IN_PRODUCTION)
            {
            throw $e;
            }
    
            $request->status = 500;
            $request->response = Request::factory('err/500')->execute();
        }
    }
    catch (exception $e)
    {
            if (!IN_PRODUCTION)
            {
                throw $e;
            }
            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
            <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
            </head>
            <body>
            here is the message that everything is veeeery bad
            </body>
            </html>';
            exit;
    }
    

    Exception404:

    class Kohana_Exception404 extends Kohana_Exception
    {
        public function __construct($message = 'error 404', array $variables = NULL, $code = 0)
        {
            parent::__construct($message, $variables, $code);
        }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.