When you see this status
- Permanent URL change for a resource
- Domain migration with new base URLs
- SEO restructuring with new paths
- Content moved to a different server
Common causes
- URL restructuring or refactoring
- Domain or subdomain consolidation
- SEO best practices enforcement
- Server or hosting provider change
How to debug it
- Verify the new Location header in response
- Check if client follows redirects automatically
- Inspect browser console for redirect loops
- Validate the new URL is accessible
- Review server logs for redirect chains
Return this code in your framework
Express (Node.js)
res.redirect(301, 'https://new.example.com/path');
FastAPI (Python)
return RedirectResponse(url='https://new.example.com/path', status_code=301)
NestJS
@Get() @Redirect('https://new.example.com/path', 301) getRedirect() {}
Go (net/http)
http.Redirect(w, r, "https://new.example.com/path", http.StatusMovedPermanently)
About HTTP 301
HTTP status code 301 Moved Permanently is part of the
3xx Redirection family. Resource permanently moved to a new URL; clients should update bookmarks. Understanding it is essential for
backend engineers, API designers, and anyone debugging integrations between services.
The Qaynaq Labs HTTP Status Code Explainer covers all standard codes with practical guidance:
what triggers them, how to debug them in production, and exactly how to return them from common
frameworks. Each code page is hand-curated and verified.