Redirection (3xx)

HTTP 301 β€” 301 Moved Permanently

This and all future requests should be directed to the given URI in the Location header.

Common Causes & Diagnoses
  • β€’Site migration, domain change, HTTP to HTTPS redirect, URL restructuring.
Spesifikasyon & Kategori
Status Code:301
Category:Redirection (3xx)
RFC Standard:RFC 9110 / HTTP/1.1 & HTTP/2
Multi-Language Code Implementations

How to Handle, Return & Test HTTP 301

Status: 301 301 Moved Permanently
server.js / handler.ts
// Express.js Server Response
app.get('/api/resource', (req, res) => {
  return res.status(301).json({ success: true, status: 301 });
});

// Client-side fetch error check
const response = await fetch('/api/resource');
if (response.status === 301) {
  console.warn('Received HTTP 301 301 Moved Permanently');
}
πŸ’‘ Pro Tip: Ensure appropriate error handling middleware or proxy interceptors are enabled so client applications receive structured JSON responses for HTTP 301.
How to Fix / Practical Code Solutions

Nginx 301 Permanent Redirect

Add a 301 redirect block in nginx.conf.

return 301 https://example.com$request_uri;
Other Popular HTTP Status Codes
Frequently Asked Questions

Common Questions About HTTP 301 to RFC Standard

Everything you need to know regarding specifications, syntax, and security best practices.

This and all future requests should be directed to the given URI in the Location header. In Turkish: Talep edilen sayfa kalıcı olarak yeni bir URL adresine taşındı.