title: Magento redirect to login page while user not login on landing
body: <p>I want to redirect the user to login page on landing, While user is not logged in. </p>
  
  <p>for example :-</p>
  
  <pre><code>example.com -&gt;(not logged in)-&gt; redirect to login page.
  
  example.com -&gt;(logged in)-&gt; redirect to Home page.
  </code></pre>
  
  <p>How can i do this ?</p>
  
  <p>I was found some function like this </p>
  
  <pre><code>public function preDispatch()
  {
      parent::preDispatch();
  
      if (!Mage::getSingleton('customer/session')-&gt;authenticate($this)) {
          $this-&gt;setFlag('', 'no-dispatch', true);
      }
  }
  </code></pre>
  
  <p>How can i use or where should i use this.</p>
  
  <p>Hope some will have experience on this. Thanks in advance</p>