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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:11:14+00:00 2026-05-26T03:11:14+00:00

I want to change the default route on my application to use an optional

  • 0

I want to change the default route on my application to use an optional parameter via Bootstrap.php, not in the application.ini. I am having trouble setting up all “escape” routes, I even don’t know If I need to set up several routes or if I can do with only one!

The route must be something like

":module/:area/:controller/:action"

where :area is optional and defaulted to “public”

So in any access to http://www.example.com/my_module/my_controller/my_action I can get via a FC plugin the following:

$request->getParam('area') = "public"

And in http://www.example.com/my_module/my_area/my_controller/my_action I get:

$request->getParam('area') = "my_area"

The main trouble is creating all routes so it escapes to default module, index controller and index action in case those are not passed too and loading http://www.example.com/ returns same as http://www.example.com/default/public/index/index.

And I want to use URL Helper to generate internal URL´s and it respects the correct assembly on this new Default Route.

Edit: I figured that default Route comes with a fail-safe for the module, if it don’t exist it defaults to the controller, but how to mimic similar behavior for other parts of the URL and the module itself when creating it in the Bootstrap.

Can anybody give me some light or suggest where can I find an working example ?

  • 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-05-26T03:11:15+00:00Added an answer on May 26, 2026 at 3:11 am

    The solution was indeed to extend Zend_Controller_Router_Route_Abstract and create a new Route handler to go through the url, verify the existence of modules, areas, controllers and actions to build a full functional url or dispatch to the error controller.

    The heavy work is done between the match() and assemble() methods and I used as reference the Zend class Zend_Controller_Router_Route_Module tht do similar task for the module, but instead of verifying if module exists with the dispatcher I created a whitelist of allowed areas, if it fails to match, it considers that that path part is the controller, the next the action and further parts are parameters.

    It worked like magic!

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

Sidebar

Related Questions

I am writing a rails 3 application and want to change an existing route
i want to change the default route in RoR to what i want: consider
How to use custom variables when using twitter-bootstrap-rails gem? I want to change the
In my application i have Tab bar Controller. I want to change default color
I want to change the default arguments passed to a Ruby function. For example,
I want to change the default homepage (which appears on typing http://myserverip:8080) and redirect
I want to modify / change the way the floatformat works. By default it
I want to change the logging level depending if I'm debbugging or not, but
Firefox is set as Windows' default browser. I want to change the default browser
I want to route packets sended from my application to another gateway but i

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.