title: Can I make CakePHP return a suitable status code based on certain conditions?
body: <p>This question is slightly related to my old post <a href="https://stackoverflow.com/questions/940326/dealing-with-alias-urls-in-cakephp/">Dealing with Alias URLs in CakePHP</a></p>
  
  <p>After much thought, I am exploring the option of having a custom 404 script in my Cake App, that is reached when a URL does not map to any controllers/actions. This script would check $this->here and look it up in a database of redirects. If a match is found it would track a specific 'promo' code and redirect.</p>
  
  <p>I'm thinking status codes. Can I make my script return a suitable status code based on certain conditions? For example:</p>
  
  <ol>
  <li>URL matches a redirect - return a 301 </li>
  <li>URL really does not have a destination - return a 404.</li>
  </ol>
  
  <p>Can I do this?</p>
  
  <p>EDIT:</p>
  
  <p>What about this? Anyone see any problems with it? I put it in app_controller.</p>
  
  <pre><code>function appError($method, $params) {
  
      //do clever stuff here
  
  }
  </code></pre>