Location

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
Forbidden header name No

Syntax

http
Location: <url>

Directives

<url>

May be relative to the request URL or an absolute URL.

Examples

http
Location: /index.html

Specifications

Specification
HTTP Semantics
# field.location

Browser compatibility

BCD tables only load in the browser

See also