Based on the RFC it seems like the Location field in an HTTP response for a 302 should be absolute. https://www.rfc-editor.org/rfc/rfc2616#section-14.30
If this statement is correct, do browsers honor this - or do they allow relative paths?
A 302 redirect does not pass the “juice,” or keep your domain authority to its new location. It simply redirects the user to the new location for you so they don't view a broken link, a 404 not found page, or an error page.
Does a 302 automatically redirect? Yes. Since the browser is handling the communication between the server and you, it will automatically redirect to the new resource location. However, the same communication will occur with the new resource, too.
The HyperText Transfer Protocol (HTTP) 302 Found redirect status response code indicates that the resource requested has been temporarily moved to the URL given by the Location header.
RFC 2616 requires an absolute URI in the Location
, but that standard has been replaced, since June 2014. The relevant specification is now RFC 7231. The relevant section of the new standard says:
Location = URI-reference
The field value consists of a single URI-reference. When it has the form of a relative reference ([RFC3986], Section 4.2), the final value is computed by resolving it against the effective request URI ([RFC3986], Section 5).
So a relative URI is now permitted. The effective request URI is the same as the request URI in most cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With