Firefox Tomorrow

http header

Location header

View on MDN ↗

The HTTP Location response header indicates the URL to redirect a page to. It only provides a meaning when served with a 3XX redirection response or a 201 Created status response.

In redirections, the HTTP method used to make the redirected request to fetch the page pointed to by Location depends on the original method and the kind of redirection:

All responses with one of the above status codes include a Location header.

In cases of resource creation, it indicates the URL of the newly-created resource so that a client can make a request for it immediately.

Location and Content-Location are different. Content-Location indicates the URL to use to directly access the resource in future when content negotiation occurred. Location is associated with the response, while Content-Location is associated with the representation that was returned.

Header type [Response header](https://developer.mozilla.org/en-US/docs/Glossary/Response%20header)

Syntax

Location: <url>

Directives

  • <url>
    • : May be relative to the request URL or an absolute URL.

Examples

Location: /index.html

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also