I have a custom form with an action that calls my module controller, I would like to prevent the redirect and stay on the page where the form is submitted but when I try to add a wildcard in my controller index action I get a 'too many redirects error'


I've also tried




Here is my index Action in my module controller

public function indexAction()
    $params = Mage::app()->getRequest()->getPost();

    if (isset($params['country'])) {
        $this->setCountry((string)$params['country'], isset($params['hide']));

    if (isset($params['currency'])) {

And below is my form which posts to my controller

<form method="post" action="<?php echo Mage::getUrl('locale/switch'); ?>">

Is there a better way to have this form submit without redirecting to the controller.

1 Answer 1


The answer doesn't involve forcing Magento to stay on the page since


Handles this behaviour nicely for us. The problem itself was due to some pages having a secure URL which meant that Magento would redirect when the form was submitted over https the solution was to change:

<?php echo Mage::getUrl('locale/switch'); ?>


<?php echo Mage::getUrl('locale/switch',array('_secure'=>true)); ?>

Now the form can be submitted over secure and unsecure URLs without redirecting

Your Answer

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

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