Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Location

The Location response header indicates the URL to redirect a page to. It only provides a meaning when served with a 3xx status response.

The HTTP method used to make the new request to fetch the page pointed to by Location depends of the original method and of the kind of redirection:

  • If 303 (See Also) responses always lead to the use of a GET method, 307 (Temporary Redirect) and 308 (Permanent Redirect) don't change the method used in the original request;
  • 301 (Permanent Redirect) and 302 (Found) doesn't change the method most of the time, though older user-agents may (so you basically don't know).

All responses with one of these status codes send a Location header.

Beside redirect response, messages with 201 (Created) status also include the Location header. It indicates the URL to the newly created resource.

Location and Content-Location are different: Location indicates the target of a redirection (or the URL of a newly created resource), while Content-Location indicates the direct URL to use to access the resource when content negotiation happened, without the need of further content negotiation. Location is a header associated with the response, while Content-Location is associated with the entity returned.

Header type Response header
Forbidden header name no

Syntax

Location: <url>

Directives

<url>
A relative (to the request URL) or absolute URL.

Examples

Location: /index.html

Specifications

Specification Title
RFC 7231, section 7.1.2: Location Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content

Browser compatibility

Feature Chrome Edge Firefox Internet Explorer Opera Safari Servo
Basic Support(Yes)(Yes)(Yes)(Yes)(Yes)(Yes)(Yes)
Feature Android Chrome for Android Edge Mobile Firefox for Android IE Mobile Opera Mobile Safari Mobile
Basic Support(Yes)(Yes)(Yes)(Yes)(Yes)(Yes)(Yes)

See also

Document Tags and Contributors

 Contributors to this page: fscholz, teoli
 Last updated by: fscholz,