I would like to redirect the user to 404 when an error occurs from a block or helper. In the controller i can do it like this:


I would like to do the same thing from a block or helper . How can I do it ?


This should work in a helper. I believe it would happen the same in a block

return Mage::app()->getFrontController()->getResponse()->setRedirect('XXXX');

Change XXXX with no_route, or your custom path to 404 page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.