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 7682091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:29:15+00:00 2026-05-31T18:29:15+00:00

In Kohana 2 you can override the default error page by creating a custom

  • 0

In Kohana 2 you can override the default error page by creating a custom kohana_error_page.php file and putting it in your view directory. However, this overrides ALL errors not just 404’s. In the case of 500 errors, I’d still like to get the friendly orange kohana error page.

Does anyone have experience in doing this?

  • 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-31T18:29:17+00:00Added an answer on May 31, 2026 at 6:29 pm

    I have not tested this!! So backup your code before you do this.

    If I’m not mistaken, Kohana2 has hard-coded exception handling and there is no pretty way to add new exceptions. To work around that, you will have to make change in the core.

    In the file system/i18n/en_US/errors.php

    • add new entry:

      E_PAGE_ACCESS_DENIED => array( 1, 'Access Denied', ' -- message text-- ')
      

    In the file system/i18n/en_US/core.php

    • add new entry:

      'page_access_denied' => 'You are not permitted to access %s .'
      

    In the system/core/Koahana.php:

    • near the top of Kohana::setup() method, add new constant:

      define('E_PAGE_ACCESS_DENIED', 69);
      
    • register the the event for your custom error ( somewhere near the end of same Kohana::setup() you will see registration for 404th error) :

      Event::add('system.403', array('Kohana', 'show_403'));
      
    • next, find the location for Kohana::show_404() and create you own method:

      public static function show_403($page = FALSE, $template = FALSE)
      {
          throw new Kohana_403_Exception($page, $template);
      }
      
    • scroll down to the bottom of the file .. there you will find the class definition for the Error_404_Exception … make one for 403. Don’t forget to:

      1. define new variable protected $template = 'file_name_for_template';
      2. protected $code = E_PAGE_ACCESS_DENIED;
      3. Exception::__construct(Kohana::lang('core.page_access_denied', $page));
      4. header('HTTP/1.1 403 Forbidden');

      the template file will have to be located at system/views/

    Now you should be able to call Event::run('system.403'); from anywhere in the application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Uploadify and Kohana and I'm creating file uploader. User can upload only
In Kohana 3, how can I override/extend a module class? E.g. I want to
In Kohana 3 bootstrap.php one can define base_url : Kohana::init(array( 'base_url' => '/foo/', ));
In Kohana/CodeIgniter, I can have a URL in this form: http://www.name.tld/controller_name/method_name/parameter_1/parameter_2/parameter_3 ... And then
I am (newbie) using Kohana V 3.0.3 and my directory structure is: pojectsys (kohana's
Can anyone help me with Kohana ORM. I can take out name and value.
i can't find complete list of kohana validation rules list, can someone point me
As far as Kohana is concerned, can you give me a short sentence or
I need to call a Kohana helper (or any php MVC framework) from a
Is there an easy way to use a Kohana DB config file in a

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.