301

Moved Permanently

3xx Redirection

Back to list

Server perspective

Use 301 for permanent redirects when moving the resource for good and method preservation is not the main concern.

When to use

  • Return 301 for permanent content moves, canonicalization, and domain migrations
  • Prefer 308 instead when redirected POST, PUT, or PATCH requests must keep the same method and body

How to respond

  • Include a Location header with the new URI
  • Keep the target stable so caches, crawlers, and clients are not whipsawed by conflicting permanent redirects

Headers to consider

  • Location
  • Cache-Control

Response body

  • A response body is optional, but the redirect target should be clear from the Location header

Server-side pitfalls

  • Do not use 301 when the move is only temporary
  • Do not assume every client will preserve POST on automatic redirects

Examples

Canonical article path

Request:GET /blog/http-redirects-intro
Response:301 Moved Permanently with Location: /articles/http-redirects-intro

The server consolidates traffic onto the permanent canonical path.

References

Related 3xx Redirection Codes