A post from W3C titled Use standard redirects: don't break the back button! is obviously says that: unless the redirection is from "refresh" technique (as opposed, HTTP redirect) browser wouldn't catch the redirector.
Quote from that post about HTTP Redirect
A "HTTP Redirect" on the other hand acts much more directly because it is done within another layer. When the User Agent (i.e. a browser or the validator) first contacts the server and requests the document, the server itself, having been configured to redirect the document to another address, replies to the user-agent that it should instead look at the new address.
That specifically telling /some-page.php
is moved to /another-page.php
(I somewhat thinking that they're could also said as 'identical'). Since then, as per question, browser back button will goes to foo.com
directly.
About this function
header('Location: http://www.foo.com/another-page.php');
It uses Location
header which you can read about it from spec here.
As for testing, you can try any URL shortener such as goo.gl. It implements 301 redirection. You won't get the shortened URL back once you visit the URL with browser back button. Or just go to fb.com, you'll be redirected to facebook.com and sure won't go back to the former URL (what's the point of domain masking if you're not actually hidding it?)
A note from Wikipedia, another way to push redirector to browser history is by JavaScript
window.location='http://www.example.com/'