301 Moved Permanently

All status codes
3xx · Redirectionretryable

301Moved Permanently

This and all future requests should be directed to the given URI.

What this code obliges you to do

Retry

Safe to retry

Repeating the same request can succeed, so a client may back off and try again. Honour Retry-After when the response sends one.

Caching

Cacheable by default

RFC 9110 lists this code as heuristically cacheable, so a cache may store it even with no Cache-Control header. Send explicit headers if that is not what you want.

Response body

Body allowed

You may return a payload explaining the outcome — for an error, a machine-readable problem document is worth the effort.

Method

May be rewritten to GET

User agents have long rewritten POST to GET when following this code, and the body is dropped. Use 307 or 308 if the method matters.

Indexing

Target replaces the old URL

A permanent redirect tells search engines to move the URL and carry its ranking signals across. Use it for migrations you are not undoing.

When you see it

3
1

Site migration

2

URL structure changes

3

HTTP to HTTPS redirect

Effect on search

Highly beneficial when changing URLs. Search engines will pass most/all link equity to the destination and replace the old URL in the index.

How to send it

2
Node.js (Next.js)
return NextResponse.redirect(newUrl, 301);
Nginx
return 301 https://$host$request_uri;

Codes people confuse with this one

3
Class3xx
RetrySafe
CacheDefault
BodyAllowed