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/301301 vs similar status codes
301 is permanent: browsers cache it and search engines transfer ranking signals to the new URL. 302 is temporary: the original URL stays indexed.
Both are permanent. 301 lets clients change POST to GET when following the redirect; 308 strictly preserves the method and body.
Frequently Asked Questions
What does HTTP Status 301 mean?
Why am I getting a 301 status code?
How do I fix a 301 Moved Permanently error?
What is the difference between 301 Moved Permanently and 302 Found?
What is the difference between 301 Moved Permanently and 308 Permanent Redirect?
How can I test how my app handles a 301 response?
Other 3xx status codes
Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.