1

I'm trying to create a mod rewrite expression to redirect from localhost/1234 to localhost/controller/action?param=1234.

I have the following in my bootstrap.php, which redirects all requests in the form localhost/number

$routePublic = new Zend_Controller_Router_Route_Regex('^[\d]+(\.[\d]+){0,1}$', array( 1 => '' ,'controller' => 'content', 'action' => 'public'));

However, I need to pass a param to my publicAction.

Thanks for the help. Newbies like me appreciate it more than you could ever believe!

Matt
  • 69
  • 1
  • 6

1 Answers1

1

try this:

$frontController = Zend_Controller_Front::getInstance();
$frontController->getRouter()->addRoute('name_of_route', 
            new Zend_Controller_Router_Route('/url_of_route/*', 
            array('controller'=>'controller_you_want_to_call','action'=>'action_you_want_to_call')));

note that the "*" after "url_of_route" is like a wildcard meaning anything can come after it

Also heres a link to a good article

locrizak
  • 12,192
  • 12
  • 60
  • 80
  • Thanks for the help! I didn't end up using this specific solution, but it guided me in the right direction. :) – Matt May 26 '11 at 16:01