{"id":1572,"date":"2022-08-30T15:17:39","date_gmt":"2022-08-30T15:17:39","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/how-to-setup-a-custom-404-page-for-a-kohana-v3-app-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:17:39","modified_gmt":"2022-08-30T15:17:39","slug":"how-to-setup-a-custom-404-page-for-a-kohana-v3-app-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-to-setup-a-custom-404-page-for-a-kohana-v3-app-collection-of-common-programming-errors\/","title":{"rendered":"How to setup a custom 404 page for a Kohana v3 app-Collection of common programming errors"},"content":{"rendered":"<p>Replace the last line of <strong>bootstrap.php<\/strong> with:<\/p>\n<pre><code>\/**\n* Set the production status\n*\/\ndefine('IN_PRODUCTION', FALSE);\n\n\/**\n* Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].\n* If no source is specified, the URI will be automatically detected.\n*\/\n$request = Request::instance();\n\ntry\n{\n    $request-&gt;execute();\n}\ncatch (Kohana_Exception404 $e)\n{\n    $request = Request::factory('error\/404')-&gt;execute();\n}\ncatch (Kohana_Exception403 $e)\n{\n    $request = Request::factory('error\/403')-&gt;execute();\n}\ncatch (ReflectionException $e)\n{\n    $request = Request::factory('error\/404')-&gt;execute();\n}\ncatch (Kohana_Request_Exception $e)\n{\n    $request = Request::factory('error\/404')-&gt;execute();\n}\ncatch (Exception $e)\n{\n    if ( ! IN_PRODUCTION )\n    {\n        throw $e;\n    }\n\n    $request = Request::factory('error\/500')-&gt;execute();\n}\n\necho $request-&gt;send_headers()-&gt;response;\n<\/code><\/pre>\n<p>Create new controller &#8220;<strong>error.php<\/strong>&#8220;:<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-27 11:52:44. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Replace the last line of bootstrap.php with: \/** * Set the production status *\/ define(&#8216;IN_PRODUCTION&#8217;, FALSE); \/** * Execute the main request. A source of the URI can be passed, eg: $_SERVER[&#8216;PATH_INFO&#8217;]. * If no source is specified, the URI will be automatically detected. *\/ $request = Request::instance(); try { $request-&gt;execute(); } catch (Kohana_Exception404 $e) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1572","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1572"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1572\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}