{"id":632,"date":"2011-12-19T08:52:53","date_gmt":"2011-12-19T16:52:53","guid":{"rendered":"http:\/\/blog.portnumber53.com\/?p=632"},"modified":"2011-12-19T08:52:53","modified_gmt":"2011-12-19T16:52:53","slug":"kohana-3-2-6-change-default-route","status":"publish","type":"post","link":"https:\/\/blog.portnumber53.com\/index.php\/2011\/12\/19\/kohana-3-2-6-change-default-route\/","title":{"rendered":"Kohana 3.2.6: Change Default Route"},"content":{"rendered":"<p>Let&#8217;s define a redirect module that will handle all requests that were not handled by any other controller. It will also be a good place to include a 404 page.<\/p>\n<p>modules\/application\/bootstrap.php<\/p>\n<pre>Kohana::modules(array(\n.\n.\n'redirect' =&gt; MODPATH . 'redirect', \/\/Redirect module\n.\n.\n));\n\nRoute::set('default', '(&lt;request&gt;)',\n array(\n 'request' =&gt; '(.*)',\n ))\n -&gt;defaults(array(\n 'controller' =&gt; 'redirect',\n 'action' =&gt; 'index',\n ));<\/pre>\n<p>&nbsp;<\/p>\n<p>And then define the controller itself:<\/p>\n<p>modules\/redirect\/classes\/controller\/redirect.php<\/p>\n<pre>&lt;?php defined('SYSPATH') or die('No direct script access.');\n\/**\n * Handles all the redirecions that may happen\n *\n * @package......Redirect\n * @category.....SEO\n * @author.......Mauricio Otta\n * @copyright....PortNumber53.com\n *\/\n\nclass Controller_Redirect extends Controller {\n\n  static public function action_index() {\n    echo \"Controller_Redirect::action_index();&lt;br \/&gt;\";\n    echo Request::current()-&gt;param('request');\n  }\n\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s define a redirect module that will handle all requests that were not handled by any other controller. It will also be a good place to include a 404 page. modules\/application\/bootstrap.php Kohana::modules(array( . . &#8216;redirect&#8217; =&gt; MODPATH . &#8216;redirect&#8217;, \/\/Redirect module . . )); Route::set(&#8216;default&#8217;, &#8216;(&lt;request&gt;)&#8217;, array( &#8216;request&#8217; =&gt; &#8216;(.*)&#8217;,&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/blog.portnumber53.com\/index.php\/2011\/12\/19\/kohana-3-2-6-change-default-route\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-632","post","type-post","status-publish","format-standard","hentry","category-kohana"],"_links":{"self":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/comments?post=632"}],"version-history":[{"count":0,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/632\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/media?parent=632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/categories?post=632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/tags?post=632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}