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!

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the help! I didn't end up using this specific solution, but it guided me in the right direction. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.