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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:28:36+00:00 2026-05-11T19:28:36+00:00

I am using the mod-rewrite router. I am trying to add a Route to

  • 0

I am using the mod-rewrite router.

I am trying to add a Route to the router that will convert the following url:
baseurl/category/aaa/mycontroller/myaction/param/value

to be:
Controller=mycontroller
action=myaction

–parameters–

category=aaa
param=value

I am using the following (not working) in my bootstrap, _front is the frontController

$Router=$this->_front->getRouter();
$CategoryRoute = new Zend_Controller_Router_Route('category/:category/:controller/:action/*');
$Router->addRoute('category', $CategoryRoute);

The error I get is a thrown router exception when I am using the Zend_View::url() helper (with or without giving it the name of the new route).
The exception is thrown only when I have baseurl/category/….

What am I missing?

What I missed:
Since there was [category] in the url, The router that was used is the one defined above.
When I used the url() helper, I didn’t give any value in it to the [category] hence there was no value for this key in the url parts->failure.
Giving a default, makes it work.

  • 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-11T19:28:37+00:00Added an answer on May 11, 2026 at 7:28 pm

    You should include the /* as suggested by solomongaby.

    If not supplying all of the required parameters (i.e. category, controller and action), you will need to specify defaults.

    You can do so as follows:

    $Router=$this->_front->getRouter();
    
    $CategoryRoute = new Zend_Controller_Router_Route('category/:category/:controller/:action/*',
        array(
            'controller' => 'index',
            'action'     => 'index',
            'category'   => null
        )
    );
    $Router->addRoute('category', $CategoryRoute);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using mod_rewrite to put a category name in the URL, like locahost/categoryName
I'm using Mod Rewrite for IIS 7.0 from iis.net and want to redirect requests:
I am trying to rewrite URLs using mod_rewrite. It is enabled in httpd.conf and
I'm trying to hide actual sub-directory from url path using mod_rewrite. The folder actual
Quick one. I'm using mod rewrite and have most replacements in place: empty space
I have a legacy PHP application that uses the following URL structure /product_info.php?products_id=YYY where
I am new to using mod_rewrite and am trying to rewrite pages at the
It is possible to rewrite my url using mod_rewrite and htaccess where a user
I am trying to cleanup my URL using mod_rewrite. In my URLs I have:
I want to redirect to http referer page using mod rewrite htaccess. For example,

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.