Redirect to home page in Controller
-
29-09-2020 - |
Question
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.
Solution
I reckon you should try to the following:
$this->_redirect("/");
OTHER TIPS
You can try below code
$url = Mage::getBaseUrl();
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
$this->_redirectUrl('/magento');
Where "magento" is my root folder name. (For localhost/magento..)
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange