title: Is it possible to send a 401 Unauthorized AND redirect (with a Location)?
body: <p>I'd like to send a <code>401 Unauthorized</code> AND redirect the client somewhere. However:</p>
  
  <p>if I do it like this:</p>
  
  <pre><code>header('HTTP/1.1 401 Unauthorized');
  header('Location: /');
  </code></pre>
  
  <p>the server sends a <code>302 Found</code> with <code>Location</code>, so not a <code>401 Unauthorized</code>.</p>
  
  <p>If I do it like this:</p>
  
  <pre><code>header('Location: /');
  header('HTTP/1.1 401 Unauthorized');
  </code></pre>
  
  <p>the browser receives both a <code>401 Unauthorized</code> and a <code>Location</code>, but does not redirect.</p>
  
  <p>(IE 9 and Chrome 16 behave the same, so I'm guessing it's correct)</p>
  
  <p>Maybe I'm misusing HTTP? I'd like my app interface to be exactly the same for all clients: text browser, modern browser, API calls etc. The 401 + response text would tell an API user what's what. The redirect is useful for a browser.</p>
  
  <p>Is there a (good) way?</p>