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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:49:23+00:00 2026-06-05T04:49:23+00:00

I am trying to set up multiple routes to the same controller in zend

  • 0

I am trying to set up multiple routes to the same controller in zend as such:

URL                                            | Controller::Action
=================================================================================
http://mysite/tasks/:level/                    | Objectives::Objectives
http://mysite/tasks/:level/:objective/         | Objectives::tasks
http://mysite/tasks/:level/:objective/:taskID/ | Objectives::view

I’ve tried the following:

<?php
$router->addRoute('objectives', new Zend_Controller_Router_Route(
    'task/:level/:objective/:taskID/',
    array(
        'controller' => 'objectives',
        'action'     => 'view'
    )
));
$router->addRoute('objectives', new Zend_Controller_Router_Route(
    'task/:level/:objective/',
    array(
        'controller' => 'objectives',
        'action'     => 'tasks'
    )
));
$router->addRoute('objectives', new Zend_Controller_Router_Route(
    'task/:level/',
    array(
        'controller' => 'objectives',
        'action'     => 'tasks'
    )
));
?>

However the last rule seems to overwrite the previous rules in the router.. I’ve read the Zend Documentation for the router over and over, I have a feeling im just missing something – should I be using a different router class?

Any help is Much Appreciated

  • 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-05T04:49:24+00:00Added an answer on June 5, 2026 at 4:49 am

    As suspected I was overwriting the previous rules. The first argument for addRoute() is a name for the route, not the controller you are routing to as I thought. Giving each route a unique name fixed the problem.

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

Sidebar

Related Questions

I'm trying to set multiple combo boxes to all having the same set of
I'm trying to set up multiple dialogs in the same page, trying to open
I'm trying to set up a while loop that inserts multiple rows into a
so i'm trying to set up an application where i have multiple panels inside
I am trying to upload multiple images and I have a jquery plugin set
I am trying to collect some data from multiple subsets of a data set
I have spend all morning trying to set up multiple cores on a SOLR
I'm trying to set up a form with multiple dropdown lists, that will allow
I'm trying to set up forms authentication across multiple servers and subdomains. I have
I'm trying to set a variable that can be accessed from multiple children at

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.