There are some many ways to redirect users/visitors in magento. But the most easy way i found is written below.
To redirect the users/visitors to login page you can add below line of code in head.phtml of your current theme.
<?php // Added by Vaseem to redirect non logged in user to login page $currentUrl = $this->helper('core/url')->getCurrentUrl(); echo 'currentUrl->'.$currentUrl.'<br>'; $loginStatus = ''; if ( strpos( $currentUrl, "customer" ) !== false ) { $loginStatus = 1; } if(!$this->helper('customer')->isLoggedIn() && $loginStatus!=1){ echo 'redirect to login page now'; Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account/login/')); } ?>
Pretty nice post. I just stumbled upon your weblog and wished to say that I’ve truly enjoyed surfing around your blog posts. In any case I’ll be subscribing to your feed and I hope you write again very soon!
Its not my first time to visit this website, i am browsing this site dailly and take pleasant facts from
here every day.