Skip to content

301 Moved Permanently

The resource has a new permanent URL, given in Location. Clients and search engines should update their references.

Status

HTTP/1.1 301 Moved Permanently

Details

  • Category: 3xx
  • Status: Standard. Registered with IANA and defined by a current standards-track RFC.
  • Specification: RFC 9110 §15.4.2
  • Cacheable: Cacheable by default
  • Response body: Allowed
  • Retry: Safe to retry

301 is the canonical way to move a URL. Search engines transfer ranking signals to the target, browsers cache the redirect aggressively, and well-behaved clients rewrite stored links. That permanence is the point, and it is also the danger: a wrong 301 can be cached in a browser for a long time and is painful to undo.

For historical reasons clients are allowed to rewrite a POST to the new URL as a GET, and in practice they do. If the method must be preserved, use 308 instead.

Note: Browsers cache 301s aggressively and can hold them for a long time. Use a short max-age while a migration is still being validated.

Headers

  • Location: Required. The new permanent URL. Absolute URLs avoid ambiguity with relative resolution.
  • Cache-Control: Use a short max-age while a migration is still being validated, since 301s are cached hard by default.

Common causes

  • A site migrated to a new domain, a new path structure, or HTTPS.
  • A canonical host rule redirected the apex domain to www or the reverse.
  • A trailing slash or letter-case normalization rule fired.

Usage notes

For clients

  • Follow the Location header and update stored URLs so later requests skip the hop.
  • Cap redirect chains. A loop between two 301s will otherwise spin until the client's limit is hit.
  • In curl use -L to follow, and -I to inspect the chain without downloading bodies.

For servers

  • Redirect to the specific equivalent URL, not to the homepage. Bulk redirects to / lose ranking signal and confuse users.
  • Collapse chains. A single hop from the old URL to the final URL beats three chained 301s.
  • Use 308 where the request method must survive the redirect.

Examples

Moving a page permanently

A request for a URL that has moved:

HTTP request

GET /old-product HTTP/1.1
Host: www.example.com

The response names the new permanent URL. Clients and search engines are expected to update their references:

HTTP response

HTTP/1.1 301 Moved Permanently
Location: https://www.example.com/products/new-product
Cache-Control: max-age=3600

Notes for proxy users

Redirect behavior is one of the clearest signals when testing a proxy: a site that answers a residential IP with 200 but answers a flagged datacenter IP with a 301 to a challenge page is doing IP-based filtering rather than blocking outright.

Specifications

See also