DevKits
301

Moved Permanently

3xx Redirection

Last updated:

The resource has been permanently moved to a new URL. Clients and search engines should update their references.

Description

The Location header specifies the new URL. Search engines transfer the vast majority of SEO signals (link equity) from the old URL to the new one via 301, making it the correct choice for permanent migrations.

When to use

Use 301 for permanent URL migrations, HTTPS upgrades, and www-to-apex canonicalization.

Common pitfalls

Do not use 301 for temporary A/B tests or maintenance redirects — use 302 instead.

Specification

RFC 9110 §15.4.2

Examples

HTTP response
HTTP/1.1 301 Moved Permanently
Content-Type: application/json

Location: /new-url
Node.js (Express)
res.status(301).redirect("/new-url");
Go (net/http)
w.WriteHeader(http.StatusMovedPermanently)
Python (Flask)
return jsonify({"error": "Moved Permanently"}), 301

Related status codes

All 3xx codes