301 redirect (Moved Permanently)
The resource has a new permanent URL. Clients should use the URL in the Location header from now on, and search engines should replace the old URL with the new one.
How Google handles a 301
Google treats a 301 as a strong signal that the target should become the canonical URL. PageRank and other signals are consolidated to the new URL. Browsers cache 301s heuristically, often for a long time, unless Cache-Control says otherwise.
Use a 301 for
- A page, section or whole domain has moved for good
- HTTP → HTTPS and www ↔ non-www consolidation
- Merging two pages into one
- Changing URL structure in a redesign or CMS migration
Don’t use it for
- Temporary situations (sales, maintenance, A/B tests): use 302 or 307
- Form or API endpoints that receive POST: use 308, because clients may turn the POST into a GET
- Pointing many unrelated old pages at the homepage: Google may treat these as soft 404s
What happens to a POST
A browser sends POST /checkout with a form body. The server answers with…
Permanent, method may change. RFC 9110 lets a client switch POST to GET for historical reasons, and every major browser does. The form data is lost at /pay.
Setting up a 301
Apache (.htaccess)
Redirect 301 /old-page /new-pageNginx
location = /old-page { return 301 /new-page; }vercel.json
{ "redirects": [{ "source": "/old-page", "destination": "/new-page", "statusCode": 301 }] }Netlify _redirects
/old-page /new-page 301Need rules for a whole list of URLs? The redirect rule generator writes them for Apache, Nginx, Vercel and Netlify.
Check that it works
Questions
How long should I keep a 301 redirect?
Google recommends keeping redirects for at least a year after a move; keeping them indefinitely is safest because old backlinks and bookmarks keep sending visitors.
Does a 301 pass link equity?
Yes. Google has stated that 3xx redirects do not lose PageRank; the signals move to the target URL.
Can I undo a 301?
Yes on the server, but browsers that already cached it may keep redirecting until the cache expires or the user clears it. Test permanent redirects carefully before going live.
Other codes: 302 · 303 · 307 · 308 · 301 vs 302