Back to HTTP Headers
Response

HTTP Location Header

Indicates the URL to redirect a client to. Used in 3xx redirect responses and 201 Created responses.

Purpose

Tells the client where to find the requested resource (for redirects) or where a newly created resource is located.

Location: <url> Example: Location: https://api.example.com/users/123 Example: Location: /new-path/page.html

Code Examples

See how to use the Location header in different tools and languages.

curl -I https://example.com/old-page
# HTTP/1.1 301 Moved Permanently
# Location: https://example.com/new-page

# Follow redirects:
curl -L https://example.com/old-page

Related Headers

Test Your APIs

location headerhttp locationhttp headers guide