HTTP 301 Moved Permanently

The resource has a new URL, given in the Location header, and clients should use it from now on.

Defined in RFC 9110 §15.4.2 — 301 Moved Permanently · MDN reference

Where you meet HTTP 301 in production

Domain moves, HTTPS upgrades, trailing-slash normalisation, and any URL you want search engines to forget in favour of a new one.

Why you would test it

Check whether your client follows the redirect, and whether it preserves the method and body when it does — many libraries silently turn a redirected POST into a GET.

What your client should do about a 301

Follow the Location header, and update anything you have stored — the whole point of "permanently" is that the old URL should not be requested again. Note that many clients historically rewrite the method to GET when following a 301 after a POST; if the method must be preserved, the server should send 308.

301 versus the codes it gets confused with

Endpoints that return 301

1 endpoint in this playground answers with 301. Every one is free, needs no signup, and can be called from the browser or with curl.

Questions about HTTP 301

Does a 301 pass SEO signals?
Yes — a permanent redirect is the standard way to move ranking signals from an old URL to a new one.
Will a 301 be cached?
Aggressively, by browsers and intermediaries. That is what makes it hard to undo, and why it should be a considered decision.

Other redirection codes

All HTTP status codes · All 39 mock REST APIs · Getting started guide

Last updated