title: CakePHP Auto redirect Admin 404 to login
body: <p>I am using the Auth component and ACL to give permission to roles and redirect them to /login if they don't have the proper rights.</p>
  
  <p>That works fine for all existing controller/action. But when ever I enter a none existing controller action <code>http://www.mypage.de/fake/bla</code> I get a notFoundExeption. </p>
  
  <p>My issue with that is, that the user sees my admin layout, because the 404 is rendered within the admin layout template.</p>
  
  <p><strong>Is there a way to say that admin (or any prefix) is always restricted and users that are not logged in get redirected to the login page?</strong></p>
  
  <p>What I came up with is this, but I don't like it, because I would have to do the same for all other prefixes.</p>
  
  <pre><code>/**
   * AppController::afterFilter()
   *
   * @return void
   */
  function afterFilter() {
      if ($this-&gt;response-&gt;statusCode() === 404 &amp;&amp; !empty($this-&gt;request-&gt;params['admin'])) {
          $url = Router::url(
              array(
                  'admin' =&gt; false,
                  'plugin' =&gt; false,
                  'controller' =&gt; 'users',
                  'action' =&gt; 'login'
              )
          );
          $this-&gt;Common-&gt;flashMessage(__('You are not authorized to access that location.'), 'error');
          return $this-&gt;redirect($url);
      }
  }
  </code></pre>