Qaynaq LABS · TOOLS

HTTP · 3xx Redirection

301 Moved Permanently

Resource permanently moved to a new URL; clients should update bookmarks.

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

  1. Verify the new Location header in response
  2. Check if client follows redirects automatically
  3. Inspect browser console for redirect loops
  4. Validate the new URL is accessible
  5. 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.

Frequently asked

Does 301 affect SEO rankings?

Yes. Search engines transfer most link equity to the new URL over time. Ensure canonical tags and sitemaps are updated.

Should I use 301 or 302 for A/B testing?

Use 302 for temporary changes. 301 signals permanence, which may impact SEO negatively during testing.

Can I use 301 for non-HTTP/HTTPS resources?

Yes, but ensure the new Location is valid for the protocol (e.g., ftp://, magnet:). Clients may not handle all protocols.

Why does my browser cache 301 redirects?

Browsers cache 301 redirects aggressively for performance. Clear cache or use incognito mode to test changes.