title: cakephp redirection error after login return HTTP/1.1 302 in the logs
body: <p>I have implemented cakephp <strong>redirect()</strong> function on successfull login into my application . </p>
  
  <p>But the redirection is not working for some reasons and it is instead getting redirected to the same url , while in the APACHE logs , I can see HTTP 302 response for that redirected URL .</p>
  
  <p>My code is something as under :</p>
  
  <pre><code>if(isset($_REQUEST['submit']) &amp;&amp; $_REQUEST['submit']=='Log In')
      {
          /*Entire validation logic goes here*/
          if(isset($famUserInfo['user_type']) &amp;&amp; $famUserInfo['user_type'] == USER_TYPE_ADVERTISER)
          {
              $redirectTo = !empty($returnto)?$returnto:'/homepageadv?login=1';
          }
          else if(isset($adminUserInfo['user_type']) &amp;&amp; $adminUserInfo['user_type'] == USER_TYPE_ADMIN)
          {
                             /* My control flow comes till here successfully */
              $this-&gt;redirect("/opstool/zoneprobabilityindex");
              die;
          }
          else
          {
              $redirectTo = !empty($returnto)?$returnto:'/homepage?login=1';
          }
  
          $this-&gt;redirect($redirectTo);
          die;
      }
  </code></pre>
  
  <p>When I check in the APACHE logs , I noticed like these :</p>
  
  <pre><code>127.0.0.1 - - [14/Oct/2011:19:24:34 +0530] "POST /login?returnto= HTTP/1.1" 302 5
  127.0.0.1 - - [14/Oct/2011:19:24:34 +0530] "GET /opstool/zoneprobabilityindex HTTP/1.1" 302 12
  127.0.0.1 - - [14/Oct/2011:19:24:34 +0530] "GET /login?returnto= HTTP/1.1" 200 6057
  </code></pre>
  
  <p><strong>http://localhost:9001/login?returnto=</strong> is my login page url and this where it's returning to.</p>
  
  <p>My .htaccess contents is inside /app folder and is as follows :</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
     RewriteEngine on
     RewriteRule    ^$    webroot/    [L]
     RewriteRule    (.*) webroot/$1    [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>Please help. I am struck on this.</p>