title: Redirecting modules controller to one specific controller in HMVC codeigniter
body: <p>Making an offline app with codeigniter . The app is used for storing client data . I have used codeigniter hmvc approach . and now i have about eight modules in my app like templates , search, client , user etc ..user module checks for admin authentication . The number of modules will increase in the future . </p>
  
  <p>Now to check if a user is logged in as admin i have used this piece of code in every module in __construct() function without templates and user modules because when i try to put this code in templates or users controller then firefox says <code>Page could not be redirected properly</code></p>
  
  <pre><code>if(!$this-&gt;session-&gt;userdata('user_type')){
      redirect(base_url().'users/login');
  } 
  </code></pre>
  
  <p>Pasting this piece of code to templates and users module creates the problem . when i remove this code then everything works fine . as so user can still acess templates and user modules without login .</p>
  
  <p>I just want to know that if there is any better way of doing it without pasting this piece of code in every controllers or making guest not to access any modules or method without login . </p>