Dan
Dan

Reputation: 6504

Zend Router Regex not routing as expected

Zend Bootstrap is not following this route:

    $route = new Zend_Controller_Router_Route_Regex (
        '(.+)-hospital-lottery',
        array('module' => 'default','controller'=>'hospital','action'=>'index'),
        array(1 => 'province')
    );

Trial URL being http://mydomain.com/something-hospital-lottery

No luck even including a fourth sprintf param...I feel this has something to do with a lack of /'s.

Upvotes: 0

Views: 365

Answers (2)

drew010
drew010

Reputation: 69957

It looks fine, I tested it and it worked fine.

How are you attempting to add it to the router?

Try adding this line after you create the route:

Zend_Controller_Front::getInstance()->getRouter()->addRoute('h-lottery', $route);

Upvotes: 1

Raj
Raj

Reputation: 22926

$route = new Zend_Controller_Router_Route_Regex (
    '(.*)-hospital-lottery',
    array('module' => 'default','controller'=>'hospital','action'=>'index'),
    array(1 => 'province')
);

Upvotes: 0

Related Questions