The HTTP 301 status code stands for "Moved Permanently". It is a redirection response indicating that the requested resource has been permanently moved to a new URL, and all future requests should be directed to the new location.
When is HTTP 301 Used?
- When a website or page changes its URL permanently.
- Used in SEO (Search Engine Optimization) to ensure search engines update their links.
- Helps users and browsers automatically redirect to the new location.
Example Scenarios
- Website Migration – A company moves from
oldsite.com
tonewsite.com
. - Changing URL Structure – A page moves from
/blog-post
to/articles/blog-post
. - Enforcing HTTPS – Redirecting from
http://example.com
tohttps://example.com
.
Example
Client Request (Requesting an Old URL)
GET /old-page HTTP/1.1
Host: example.com
Server Response (Redirecting to a New URL)
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page
Summary
HTTP 301 means the requested resource has been permanently moved to a new URL, and all future requests should use the new location. It is commonly used for SEO, website migrations, and URL restructuring.