301

Moved Permanently

3xx · Redirection common

Overview

301 Moved Permanently announces that a resource has permanently moved to a new URL, given in the Location header. Browsers and search engines treat it as a permanent move, sending future requests to the new URL and transferring link equity (ranking, reputation) to it.

For SEO it is the standard tool for domain migrations, HTTP→HTTPS switches, and URL restructuring; the longer it stays in place, the more reliably search indexes update to the new URL.

When it happens

Request / Response example

Request
GET /old-page HTTP/1.1
Host: example.com
Response
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page
Content-Type: text/html

<h1>Moved Permanently</h1><p>The document has moved <a href="/new-page">here</a>.</p>

In code

location = /old-page {
    return 301 /new-page;
}
# force https + non-www
server { return 301 https://example.com$request_uri; }
app.get('/old-page', (req, res) => {
  res.redirect(301, '/new-page');
});

Notes

Related status codes

Related headers

Specification