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/')); } ?>