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.

Also searched as

Developers commonly search for 301 using phrases like 301 redirect · 301 vs 302 · 301 permanent redirect · 301 moved permanently · http 301 · 301 seo · 301 status code. All refer to the same HTTP 301 Moved Permanently response.

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

Debug 301 with these tools

Related status codes

All 3xx codes