Skip to main content
HTTP/3xx (Redirection)

301 Moved Permanently

The requested resource has been assigned a new permanent URI and any future references should use one of the returned URIs.

❓ Why does this happen?

Used for domain migrations, canonical URL enforcement (HTTP to HTTPS, non-www to www), and permanent route reorganizations.

✅ How to fix it

Update client bookmarks and hardcoded API links to the new destination provided in the Location header.

Return or handle 301 in your stack

// app/old-path/route.ts
export function GET(request: Request) {
  return Response.redirect(new URL("/new-path", request.url), 301);
}

Live 301 mock endpoint

Point your app, tests, or retry logic at this free public URL to reproduce a real 301 response (CORS enabled, optional ?delay=ms up to 5000).

https://castov.com/api/mock/301

301 vs similar status codes

Frequently Asked Questions

What does HTTP Status 301 mean?
The requested resource has been assigned a new permanent URI and any future references should use one of the returned URIs.
Why am I getting a 301 status code?
Used for domain migrations, canonical URL enforcement (HTTP to HTTPS, non-www to www), and permanent route reorganizations.
How do I fix a 301 Moved Permanently error?
Update client bookmarks and hardcoded API links to the new destination provided in the Location header.
What is the difference between 301 Moved Permanently and 302 Found?
301 is permanent: browsers cache it and search engines transfer ranking signals to the new URL. 302 is temporary: the original URL stays indexed.
What is the difference between 301 Moved Permanently and 308 Permanent Redirect?
Both are permanent. 301 lets clients change POST to GET when following the redirect; 308 strictly preserves the method and body.
How can I test how my app handles a 301 response?
Send a request to https://castov.com/api/mock/301 — it returns a real 301 Moved Permanently response with CORS enabled. Add ?delay=2000 to simulate a slow server.

Other 3xx status codes

Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.