On 303 redirect you must specify a redirect URI:
<?php
header('HTTP/1.1 303 See Other');
header('location: http://www.example.com/some-url/');
As a workaround for caching the 301 response, you can set the expiration date in the past. This way the client is encouraged to mark the response as expired immediately:
<?php
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
header('Expires: Sat, 1 Feb 1997 06:00:00 GMT');
The 303 response should not be cached by any client that respects RFC 2616:
The 303 response MUST NOT be cached, but the response to the second
(redirected) request might be cacheable.
Considering the above, you could change initial code snippet to something like this:
if ('POST' === filter_input(INPUT_SERVER, 'REQUEST_METHOD')) {
// process post request
// set http status code
header('HTTP/1.1 303 See Other');
header('Location: http://www.example.com/newurl.php'); // FULL URI HERE
exit;
}
// set http status code
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.example.com/other-page.php');
However, in your case a 307 redirect should be more appropriate. Although 307 is a temporary redirect and you will always redirect on any request that is not POST you can change this behavior in the future because as per RFC "Since the redirection MAY be altered on occasion, the client SHOULD continue to use the Request-URI for future requests". The second advantage is that: "This response is only cacheable if indicated by a Cache-Control or Expires header field."
The requested resource resides temporarily under a different URI.
Since the redirection MAY be altered on occasion, the client SHOULD
continue to use the Request-URI for future requests. This response
is only cacheable if indicated by a Cache-Control or Expires header
field.
See RFC 2616 sec. 10.3.8