title: CakePHP redirect with status code 404
body: <p>For CakePHP errors I know that there exists CakeError and AppError solutions.
  But I need to make a redirection within controller.</p>
  
  <p>In <strong>AppController</strong> there exists:</p>
  
  <pre><code>function afterFilter() {
      if ($this-&gt;response-&gt;statusCode() == '404')
      {
          $this-&gt;redirect(array(
              'controller' =&gt; 'mycontroller',
              'action' =&gt; 'error', 404),404
          );
      }
  }
  </code></pre>
  
  <p>But this doesn't create a 404 status code. It creates a 302 code.
  I changed code to this:</p>
  
  <pre><code>$this-&gt;redirect('/mycontroller/error/404', 404);
  </code></pre>
  
  <p>But the result is same.</p>
  
  <p>I added this, it didn't work also deprecated:</p>
  
  <pre><code>$this-&gt;header('http/1.0 404 not found');
  </code></pre>
  
  <p>How can I send a 404 code within controller redirect ?</p>