The server returns an HTTP response with the code 302
, indicating a temporary redirection, and includes a Location:
header indicating the new URI, e.g.
HTTP/1.1 302 Found
Location: http://some-other-url
And potentially other headers at the server s discretion.
The browser normally takes this as a directive to automatically make a new, separate request for the other URI specified by the location header. The client (browser) isn t forced to do this (it could, in theory, just display a message to the user, or do whatever else it wants), but that s how HTTP clients usually behave.
Note that since the 302 is a temporary redirection, a well-behaved client will continue to use the old URL in the future, rather than going directly to the new one (301 is a permanent redirection).