Matt
Matt

Reputation: 69

Help creating Zend Framework Redirect

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!

Upvotes: 1

Views: 169

Answers (1)

locrizak
locrizak

Reputation: 12281

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

Upvotes: 1

Related Questions