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

  • SEARCH
  • Home
  • 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 7830525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:16:20+00:00 2026-06-02T11:16:20+00:00

I have multiple controllers in my Kohana 3.2 project where the routes where initially:

  • 0

I have multiple controllers in my Kohana 3.2 project where the routes where initially:

Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'user',
'action'     => 'index',
)); 

It was working fine for all my new controllers (when I added a new file and went to: domain/controller it worked like a charm.

Now for a specific controller called parents I had to add new lines in my bootstrap:

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

Route::set('parent', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'parent',
'action'     => 'index',
)); 

I was trying to access both: /parents/ and /parent/index/id and both generated an error when not having the Route::set in place.

Without those lines, I always got errors like:

unable to find a route to match the uri

OR

The requested route does not exist

How am I supposed to do it? For every controller that I add do I need to define it in my bootstrap?

  • 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-06-02T11:16:23+00:00Added an answer on June 2, 2026 at 11:16 am

    Actually you’d be covered with just the default route in your case.

    Route::set('default', '(<controller>(/<action>(/<id>)))')
    ->defaults(array(
         'controller' => 'user',
         'action'     => 'index',
    ));
    

    First, Kohana tries to match against your regex pattern [((/(/)))]. This will match the urls: users, users/delete, users/delete/1, parents, parents/view, parents/view/2, etc.

    If Kohana is unable to find the action, it will default to index based on your defaults array rule. If Kohana is unable to find a controller (which essentially means nothing passed), then it will use controller. In the last case, it would also default the action since we can’t pass an action without passing a controller in our regex (see the parenthesis requires a controller first then action then id).

    So the following examples will route through this default pattern:

     URL: /users  
     Controller: users  
     Action: index (picked default)  
    
     URL: /users/kill/1  
     Controller: users    
     Action: kill
     Id: 1
    
     URL: /parents  
     Controller: parents  
     Action: index (picked default)    
    
     URL: /parent/view
     Controller: parent  
     Action: view  
    

    Best practice is to keep this route as the last route applied (essentially the default and catch all) and if you have urls that don’t match the pattern in the default, add them.

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

Sidebar

Related Questions

there is a situation where a have multiple controllers like a town_center controller, a
I have multiple SimpleFormController controllers. One controller contains a command object used to filter
currently I have a medium sized MVC project with multiple controllers that support paging
I have a table view project with multiple controllers and another one that is
I have multiple controllers one in Areas /Areas/Demo/Admin/AdminController and other in main site /Controller/Admin/AdminController
I have multiple view controllers that need to get the user's location, so I
Using storyboard, I have a table view controller containing multiple dynamic prototype cells. One
I have multiple controllers with different actions (no Index actions). The actions I consider
In one of my Controllers, I have multiple URLs that will ultimately render in
I want to have one model & view that is served by multiple controllers

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.