title: Kohana 3.1 routes with default subdirectories
body: <p>I have an application that is essentially working until I tried to implement an Auth module for logins and registrations.</p>
  
  <p>My application directory structure is basically:</p>
  
  <pre><code>application
  -- classes
    -- controller
       -- admin
          (admin area)
       -- block
          (blocks to display within pages)
       -- page
          (default pages)
  </code></pre>
  
  <p>By default I want to have URL's such as <a href="http://www.testsite.com/test" rel="nofollow">http://www.testsite.com/test</a> which would access the Controller_Page_Test class. Or to explicitly call admin or block pages <a href="http://www.testsite.com/admin/test" rel="nofollow">http://www.testsite.com/admin/test</a> which would access the Controller_Admin_Test class. To further complicate matters it also needs to handle optional actions and id's.</p>
  
  <p>I said at the top that this is basically working correctly - until I've tried to add in the Auth module. The Auth module calls <a href="http://www.testsite.com/user/login" rel="nofollow">http://www.testsite.com/user/login</a> but instead of accessing the module's path via the default, it looks in the page directory.</p>
  
  <p>To overcome this I placed a higher level route but now this has become my default page handler. Explicit calls still get through.</p>
  
  <p>My routes currently look like this:</p>
  
  <pre><code>Route::set('user', '(&lt;controller&gt;(/&lt;action&gt;(/&lt;id&gt;)))', array('controller' =&gt; 'user|admin_user'))
      -&gt;defaults(array(
          'controller' =&gt; 'user',
          'action'     =&gt; 'index',
          'id'         =&gt; NULL,
      ));
  
  Route::set('with_dir', '&lt;directory&gt;/&lt;controller&gt;(/&lt;action&gt;(/&lt;id&gt;))', array('directory' =&gt; 'block|admin'))
      -&gt;defaults(array(
          'directory'  =&gt; 'page',
          'controller' =&gt; 'home',
          'action'     =&gt; 'index',
      ));
  
  Route::set('just_id', '&lt;controller&gt;(/&lt;id&gt;)', array('id' =&gt; '\d+'))
      -&gt;defaults(array(
          'directory'  =&gt; 'page',
          'controller' =&gt; 'home',
          'action'     =&gt; 'index',
      ));
  
  Route::set('auto_dir', '&lt;controller&gt;(/&lt;action&gt;(/&lt;id&gt;))', array('id' =&gt; '\d+'))
      -&gt;defaults(array(
          'directory'  =&gt; 'page',
          'controller' =&gt; 'home',
          'action'     =&gt; 'index',
      ));
  
  
  Route::set('default', '(&lt;controller&gt;(/&lt;action&gt;(/&lt;id&gt;)))')
      -&gt;defaults(array(
          'controller' =&gt; 'prototype',
          'action'     =&gt; 'index',
      ));
  </code></pre>
  
  <p>Can this be cleaned up any better? And how do I get this module to only kick in when I need it to?</p>