Quick answer
HTTP 301 Moved Permanently means the resource has a new permanent URL. Clients, browsers, and search engines should update to the new location given in the Location header.
What HTTP 301 means
301 Moved Permanently tells the client the resource has permanently moved to the URL in the Location header. Browsers cache 301s aggressively, and search engines transfer ranking signals to the new URL — which is why 301 is the correct redirect for permanent URL changes and site migrations.
Common causes
- A page or endpoint permanently moved to a new URL
- Migrating from HTTP to HTTPS, or from www to non-www
- Restructuring URLs and pointing old paths to new ones
Response body
Redirects usually have no JSON body — the important part is the Location header pointing to the new URL.
Raw HTTP response
HTTP/1.1 301 Moved Permanently
Location: https://api.example.com/v2/users
Content-Type: text/html
How to handle HTTP 301
- ✓ Read the
Locationheader for the new URL - ✓ Update bookmarks, API clients, and internal links to the new URL
- ✓ Use 301 (not 302) only when the move is truly permanent
- ✓ Be aware browsers cache 301s — test carefully before deploying
301 vs 302 vs 307 vs 308 — the redirect family
There are four common redirects, and they differ on two axes: permanent vs temporary, and whether the HTTP method is allowed to change:
| Code | Permanent? | Method preserved? | Use for |
|---|---|---|---|
| 301 Moved Permanently | Yes | Not guaranteed (often changes POST→GET) | Permanent moves, migrations, HTTP→HTTPS |
| 302 Found | No | Not guaranteed | Temporary redirects |
| 307 Temporary Redirect | No | Yes (method + body preserved) | Temporary redirect that must keep POST |
| 308 Permanent Redirect | Yes | Yes (method + body preserved) | Permanent redirect that must keep POST |
If you need a permanent redirect that must preserve a POST, use 308, not 301 — historically many clients silently turned 301'd POSTs into GETs.
How to return a 301 (server config)
# nginx
return 301 https://example.com$request_uri;
# Apache (.htaccess)
Redirect 301 /old-path https://example.com/new-path
# Express (Node.js)
res.redirect(301, 'https://example.com/new-path');
Frequently Asked Questions
What is the difference between 301 and 302?
301 Moved Permanently means the resource has permanently moved — update your references and search engines transfer ranking. 302 Found means the move is temporary — keep using the original URL. Use 301 for permanent changes, 302 for temporary ones.
Does a 301 redirect help SEO?
Yes. A 301 passes the majority of ranking signals from the old URL to the new one, which is why it is the recommended redirect for permanent URL changes and migrations.
Why is my 301 redirect cached even after I changed it?
Browsers cache 301 responses aggressively because they are permanent. During development, use a 302 or clear your cache to avoid being stuck on a stale redirect.
Does a 301 change a POST into a GET?
It can. Historically many clients convert a POST into a GET when following a 301 (and 302). If you need a permanent redirect that preserves the method and body, use 308 Permanent Redirect instead.
Do API clients follow 301 redirects automatically?
Most do by default (browsers, curl with -L, axios, most HTTP libraries). But relying on redirects for an API is fragile — update the client to call the new URL directly rather than depending on the redirect long-term.
Working with a JSON API response?
Format and inspect any response in your browser — nothing is uploaded.