I'm using below function for redirection after FB login, But it's redirecting to Customers Account Dashboard, Instead of Account Dashboard I'd like to redirect to Home Page or the Previous Page.

 protected function _loginPostRedirect()
    $session = Mage::getSingleton('customer/session');

    if (!$session->getBeforeAuthUrl() || $session->getBeforeAuthUrl() == Mage::getBaseUrl()) {
        // Set default URL to redirect customer to

    } else if ($session->getBeforeAuthUrl() == Mage::helper('customer')->getLogoutUrl()) {
    } else {
        if (!$session->getAfterAuthUrl()) {
        if ($session->isLoggedIn()) {

I've tried



But it's not working

2 Answers 2


Try Using this to redirect to home page

$homeUrl = Mage::getBaseUrl();

To redirect to Previous page


to redirect to home url try to use Url Helper instead of Customer Helper
Mage::helper('url')->getHomeUrl(); @see Mage_Core_Helper_Url::getHomeUrl()

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.