DevToolsmith

HTTP 301 Moved Permanently

HTTP 301 Moved Permanently means the resource has a new permanent URL, given in the Location header. The client must take further action, usually following a redirect.

Class
3xx Redirection
Standard
RFC 9110
Cacheable by default
Yes
Safe to retry
Not applicable: this isn’t an error
Go constant
http.StatusMovedPermanently

What HTTP 301 means

Use 301 when a URL has changed for good: a new domain, HTTPS migration, or renamed pages. Search engines transfer ranking to the new URL and browsers cache the redirect, sometimes indefinitely. Historically, browsers change a POST into a GET when following 301; use 308 if the method must be preserved.

Using 301 correctly

  • Browsers cache 301s aggressively. Test with a 302 first, because a wrong 301 can stick in users’ browsers long after you fix it.
  • Avoid redirect chains (A → B → C). Point every old URL straight at the final destination.

Retrying

Not applicable: this isn’t an error.

Example response

HTTP/1.1 301 Moved Permanently
Date: Wed, 21 Oct 2026 10:30:00 GMT
Location: https://example.com/new-path

How to return 301

Node.js (Express)
res.redirect(301, '/new-path');
Python (FastAPI)
from fastapi.responses import RedirectResponse

return RedirectResponse("/new-path", status_code=301)
Go (net/http)
http.Redirect(w, r, "/new-path", http.StatusMovedPermanently)
nginx
location /old-path {
    return 301 /new-path;
}

Related status codes

  • 308 Permanent Redirect : A permanent redirect that keeps the original method and body.
  • 302 Found : A temporary redirect to the URL in the Location header.
  • 410 Gone : The resource was deliberately removed and won’t come back.

Other 3xx status codes

300 Multiple Choices · 302 Found · 303 See Other · 304 Not Modified · 307 Temporary Redirect · 308 Permanent Redirect

See the full list of HTTP status codes.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What does HTTP 301 Moved Permanently mean?

HTTP 301 Moved Permanently means the resource has a new permanent URL, given in the Location header. Use 301 when a URL has changed for good: a new domain, HTTPS migration, or renamed pages. Search engines transfer ranking to the new URL and browsers cache the redirect, sometimes indefinitely. Historically, browsers change a POST into a GET when following 301; use 308 if the method must be preserved.