I have created a custom route. with class implementing Zend_Controller_Router_Route_Interface.
How i have one problem i need to solve on match() of that route.
Match is basically looking to see if the route is matching url and return params or false
In my case there is one more possibility. In case of certain conditins i need to redirect 301 to other URL.
However, this doesn't seems to work on route match().
$front = Zend_Controller_Front::getInstance();
$response = $front->getResponse();
$response->setRedirect('new-url');
$front->setResponse($response);
return false;
I am wondering which option should be better for this:
a) i am missing something so that's why redirect doesn't work; i would try with a header('Redirect...') but i would like to stay with ZF rather...
b) i should better use my custom router class instead, and redirect would be possible here (and not into route itself)
c) i should do the checking before URL goes to router (maybe on bootstrap)
d) other option i may miss now
Thanks for any idea.
-- Best regards, Cristian Bichis www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com
没有评论:
发表评论