2

I want to redirect my site to home page (base URL) in Controller.

$this->_redirect();

Using above mentioned function gives me the warning to specify the argument.

Warning: Missing argument 1 for Mage_Core_Controller_Varien_Action::_redirect()

When I use the following as argument

$this->_redirect(Mage::getBaseUrl());

It just append the base url in my site url which results something like this

Which is obviously a 404 page. Please help me to figure this out.

10

I reckon you should try to the following:

$this->_redirect("/");
  • Thanks a lot. Brilliant.. you are right, digging more into "Mage_Core_Controller_Varien" and got the result. protected function _redirect($path, $arguments = array()) – saiid May 12 '16 at 9:04
  • @MuhammadSaiid feel free to mark your question as answered so it'll benefits for others ;) – Raphael at Digital Pianism May 12 '16 at 9:05
3

You can try below code

$url = Mage::getBaseUrl();
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
  • Yes, it worked. Thanks for let me know another way to cop this out. :) – saiid May 12 '16 at 9:16
-2
$this->_redirectUrl('/magento');

Where "magento" is my root folder name. (For localhost/magento..)

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.