The HTTP Location header is a response header that is used under 2 circumstances to ask a browser to redirect a URL (status code 3xx) or provide information about the location of a newly created resource (status code of 201). Its usage is often confused with another HTTP Header which is HTTP Content-Location header. The main difference between them is that Location gives the URL of the resource where the redirection of the page happens while HTTP Content-Location is used to indicate the URL of a transmitted resource.
Directives: This header accepts a single directive mentioned above and described below:
- <url>: This directive holds the relative or absolute URL that gives access to a resource.
- These URLs include a scheme/host and conform to scheme-specific syntax and semantics, this is an Absolute URL:
- These URLs don’t include a scheme or a host. It must be combined with the URLs of the original request, Relative URL:
To check this Location in action go to Inspect Element -> Network check the response header for Location like below, Location is highlighted you can see.
Supported Browsers: The browsers are compatible with the HTTP Location header are listed below:
- Google Chrome
- Internet Explorer
- Microsoft Edge
- HTTP headers | Content-Location
- HTTP headers | Access-Control-Expose-Headers
- HTTP headers | Access-Control-Allow-Headers.
- HTTP headers | Access-Control-Request-Headers
- HTTP headers | User-Agent
- HTTP headers | Link
- HTTP headers | Save-Data
- HTTP headers | Content-Type
- HTTP headers | X-Forwarded-Proto
- HTTP headers | X-XSS-Protection
- HTTP headers | X-Frame-Options
- HTTP headers | Last-Modified
- HTTP headers | Date
- HTTP headers | Cookie
- HTTP headers | Strict-Transport-Security
- HTTP headers | Expect
- HTTP headers | Accept-Encoding
- HTTP headers | Proxy-Authenticate
- HTTP headers | Content-Range
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.