Skip to content

301 Moved Permanently — Meaning, Common Causes & How to Fix

301 3xx Redirection RFC 9110 §15.4.2

301 Moved Permanently means: The resource has permanently moved to a new URI, given in the Location header. Clients and search engines should update their references to the new location; historically user agents may rewrite POST to GET when following it, which is why 308 exists. Redirection 3xx codes tell the client the resource lives elsewhere, or that a cached copy is still valid. The family splits along two axes: permanent versus temporary, and method-preserving versus method-rewriting. Picking the wrong member causes duplicate submissions, lost POST bodies or stale SEO signals. In practice you will meet 301 when a site migrates domains or restructures urls permanently; http-to-https or non-www-to-www canonical redirects; a renamed page keeps old links working while transferring seo value. On the client side, follow Location and update stored URLs/bookmarks; for API calls that must preserve method and body, use 308 semantics or call the new URL directly. On the server side, return 301 with an absolute Location, keep it cacheable, and avoid redirect chains; use 308 when POST bodies must survive the redirect.

Advertisement
Ad slot · ref-top

When 301 happens

  • A site migrates domains or restructures URLs permanently
  • HTTP-to-HTTPS or non-www-to-www canonical redirects
  • A renamed page keeps old links working while transferring SEO value

How to fix it

On the client

Follow Location and update stored URLs/bookmarks; for API calls that must preserve method and body, use 308 semantics or call the new URL directly.

On the server

Return 301 with an absolute Location, keep it cacheable, and avoid redirect chains; use 308 when POST bodies must survive the redirect.

Should you retry?

Follow the redirect (or reuse the cache for 304); update references if permanent.

Debugging steps

When 301 appears unexpectedly, start by capturing the full exchange: 'curl -i' or the browser DevTools Network tab shows the exact status line and response headers, which often carry the real explanation. Inspect the Location header and count redirect hops: chains and loops are the usual culprits, and DevTools shows whether the browser rewrote your method on the way. For this code specifically, check whether the most common trigger applies to your situation: a site migrates domains or restructures urls permanently. Compare your exchange against the raw HTTP example above. If you operate the server, correlate the timestamp with application and proxy logs using the request id; if you are the client, verify the request shape against the API documentation before changing anything or retrying.

Notes & gotchas

Browsers cache 301s aggressively and indefinitely by default — a wrong 301 can haunt a URL for years, so double-check the target before deploying and keep chains to a single hop.

Examples

Raw HTTP
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-path

curl
curl -i https://api.example.com/v1/resource   # observe the 301 response and its headers
JavaScript (fetch)
const res = await fetch("https://api.example.com/v1/resource");
// 301 Moved Permanently: fetch follows redirects automatically.
// Use redirect: "manual" only when you must inspect Location yourself;
// browsers rewrite POST->GET on 301/302 but preserve it on 307/308.
Python (requests)
import requests

res = requests.get("https://api.example.com/v1/resource", timeout=10)
# 301 Moved Permanently: requests follows redirects by default.
# allow_redirects=False to inspect Location; note requests preserves
# the method on 307/308 but rewrites POST->GET on 301/302 like browsers.

Frequently asked questions

Does 301 pass SEO link equity?

Yes — search engines treat 301 as a permanent move and consolidate signals to the target URL. Keep chains short (one hop) for best results.

Why did my POST become a GET after 301?

Historic browser behavior rewrites POST to GET on 301/302. Use 307/308 when the method and body must be preserved.

Which redirect code should I use?

Permanent move: 301 (GET) or 308 (method-preserving). Temporary: 302 (GET) or 307 (method-preserving). After a POST that should not repeat on refresh: 303. Cache revalidation is 304, not a redirect.

Do redirects hurt SEO or performance?

Single-hop permanent redirects (301/308) pass link equity and are fine. Chains, loops and temporary redirects for permanent moves waste crawl budget, add latency and dilute signals.

Advertisement
Ad slot · ref-in-article

Try the JSON Validator

Check JSON syntax and locate errors by line and column.

Open tool →