[nycphp-talk] Redirect after post with "HTTP/1.1 303 See Other"

csnyder chsnyder at
Wed Jan 26 12:28:19 EST 2005

To solve a casual bet I made with HansK after John Andrews' excellent
SEO presentation last night...

It turns out that there IS an HTTP Status Code for redirection after
form processing. (Sir Tim thinks of everything, he's so dreamy...)

"303 See Other ... This method exists primarily to allow the output of
a POST-activated script to redirect the user agent to a selected
resource. The new URI is not a substitute reference for the originally
requested resource. The 303 response MUST NOT be cached..."

Bear in mind that browsers which only speak HTTP 1.0 won't know what
to do with it, but there it is.

  // process form
  // redirect to results page
  header( 'HTTP/1.1 303 See Other' );
  header( 'Location: result.html' );
  exit( 'Form submitted, <a href="result.html">continue</a>.' );

Clicking refresh resubmits the get request for result.html, not the
original post request. (Same behavior as redirection with the default
302 status.) Anecdotal testing proves that it works in IE and Firefox.


More information about the talk mailing list