[nycphp-talk] Redirect after post with "HTTP/1.1 303 See Other"
Hans C. Kaspersetz
hans at cyberxdesigns.com
Wed Jan 26 13:17:58 EST 2005
+1 Chris! I owe you a cold adult beverage.
John, do you have an opinion on this?
Hans
--
Hans C. Kaspersetz
Cyber X Designs
http://www.cyberxdesigns.com
csnyder wrote:
>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..."
> -- http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4
>
>Bear in mind that browsers which only speak HTTP 1.0 won't know what
>to do with it, but there it is.
>
><?php
> // 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.
>
> chris.
>
More information about the talk
mailing list