0

how to redirect the custom controller path to specific store name

http://testurl.com/testmodule/index/testview/id/123/

to

http://testurl.com/testname

thanks

1

You can try below code in your controller to set the redirect to your custom URL.

Mage::app()->getResponse()->setRedirect($url)->sendResponse();
// or
Mage::app()->getFrontController()->getResponse()->setRedirect($url)->sendResponse();

Edit:

$this->loadLayout();
$this->getLayout()->getBlock('block_class')->setTemplate('template_file_path'));
// Do your process
$this->renderLayout();

Reference: Can you set a template for every action within a controller?

Hope it helps!!!

  • thanks it is redirecting but page is not loading with that id – Raghu Sep 10 at 7:33
  • Have you tried $this->_redirect($url); in your controller? Also Mage::app()->getResponse()->setRedirct($url); – Sumit Sep 10 at 7:37
  • no actually i am doing in controller like testurl.com/testmodule/index/testview/id/123 in test view funtion i am setting a template and loading page with current url id parameter – Raghu Sep 10 at 7:42
  • 1
    yes i have tried this, along with this i have added Router concept, this is working well now, thanks – Raghu Sep 16 at 6:24
  • 1
    no for my scenario this is ok – Raghu Sep 16 at 6:30
1

in the controller action you nned to write this line to redirect with current parameter

$this->_redirect('testname/index/index', $this->getRequest()->getParams());

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.