If you user HMVC than you can do it like this:
if(!$this->session->userdata('user_type')){
redirect('module_name/users/login'); // change module_name with your module name
}
UPDATE: Maybe, You redirect on one page that redirect also... and put on loop