I am trying to redirect to google.com using Magento.
我正在尝试使用Magento重定向到google.com。
Mage::app()->getResponse()->setRedirect('http://google.co.in'));
But when I use this code I am not able to open my home page too. It shows blank page.
但是当我使用这段代码时,我也无法打开我的主页。它显示空白页面。
What other code I can use instead of this so I can redirect to google.com?
我可以使用哪些其他代码代替此,以便我可以重定向到google.com?
2 个解决方案
#1
1
This should do the trick:
这应该是诀窍:
Mage::app()->getFrontController()->getResponse()->setRedirect('http://google.com');
Also, in your example you end with a double ), that might be the problem in your code.
此外,在您的示例中,您以双精度结尾,这可能是您的代码中的问题。
#2
0
try
Mage::app()->getResponse()->setRedirect($url)->sendHeaders()->sendResponse();
exit();
#1
1
This should do the trick:
这应该是诀窍:
Mage::app()->getFrontController()->getResponse()->setRedirect('http://google.com');
Also, in your example you end with a double ), that might be the problem in your code.
此外,在您的示例中,您以双精度结尾,这可能是您的代码中的问题。
#2
0
try
Mage::app()->getResponse()->setRedirect($url)->sendHeaders()->sendResponse();
exit();