301 Redirect
A 301 redirect is an HTTP status code that tells browsers and search engines a page has permanently moved to a new URL. Google treats it as a signal to make the new URL canonical, replacing the old address in search results and passing the old URL's accumulated link equity (ranking) to the destination.
- Use 301 or 308 for permanent moves, and 302 or 307 for temporary ones.
- A 301 makes the new URL canonical and transfers the link equity (ranking) the old URL earned to the destination.
- Temporary redirects (302 and 307) do not pass SEO value, so they should never be used for a permanent move.
- When you must preserve the request method and POST body, use 308 instead of 301, and 307 instead of 302.
- Prefer server-side redirects over JavaScript or meta refresh, since Google interprets them most reliably.
What a 301 Redirect Is
A 301 redirect (301 Moved Permanently) is the HTTP status code that signals a requested URL has moved permanently to a new location. The browser automatically follows the new address given in the response's Location header, and search engines pass the link equity the old URL had earned on to the destination. As MDN puts it, when a search engine receives a 301 response, it attributes links pointing to the original URL to the redirected resource, transferring the SEO ranking to the new URL.
Google's Search documentation distinguishes between permanent and temporary redirects, and this distinction matters most for SEO. The indexing pipeline treats permanent redirects (301 and 308) as a signal to make the redirect target canonical, so the new destination appears in search results. Temporary redirects (302, 303, and 307), by contrast, are not used as a canonicalization signal, so the originating page (the old URL) stays in the results.
When to Use a 301
- When you move a site to a new domain (for example,
http://old.com→https://new.com). - When a homepage is reachable through several URLs (
example.com/home,home.example.com,www.example.com) and you want to consolidate them onto a single preferred (canonical) address. - When you merge two sites and need links pointing to old URLs to land on the correct page.
- When you delete a page and send users to a replacement, with no plan to bring it back.
301 vs 302 vs 307 vs 308
All four codes make the browser follow the Location header automatically, but they differ in whether the move is permanent or temporary and whether the request method (GET/POST) is preserved. Method preservation is decisive for requests that carry a body, such as form submissions (POST) and API calls.
| Code | Meaning | Permanent / Temporary | Google SEO handling | Request method preserved |
|---|---|---|---|---|
| 301 Moved Permanently | Permanent move | Permanent | New URL becomes canonical; link equity transferred | Not guaranteed — POST may change to GET |
| 302 Found | Temporary move | Temporary | Old URL retained; no SEO value transferred | Not guaranteed — POST may change to GET |
| 307 Temporary Redirect | Temporary move | Temporary | Old URL retained; no SEO value transferred | Preserved — method and body reused as-is |
| 308 Permanent Redirect | Permanent move | Permanent | New URL becomes canonical; link equity transferred | Preserved — method and body must not change |
The key contrasts are as follows. 301 vs 308: both are permanent and have the same SEO effect, but although the spec says 301 should keep the method, older clients are known to switch POST to GET. When the method must be preserved, use 308 (MDN). 302 vs 307: both are temporary and pass no SEO value, but 307 differs from 302 in that it guarantees the client will not change the method or body. If you want to switch any method to GET, use 303 See Other.
In short, the standard practice is to use 301 for ordinary permanent page moves, domain migrations, and URL consolidation, and 308 for permanent moves where the POST body must also be preserved.
Implementation Examples
Google recommends using a server-side permanent redirect whenever you need to change the URL shown in search results, because server-side redirects give Google the best chance of interpreting them correctly (a JavaScript redirect can be missed if rendering fails).
Apache (.htaccess)
For simple path mapping, mod_alias is enough.
# Permanent redirect (301)
Redirect permanent "/old" "https://example.com/new"
# Temporary redirect (302)
Redirect temp "/two-old" "https://example.com/two-new"
For more complex rules such as pattern matching, use mod_rewrite.
RewriteEngine on
# Permanent (301): move /service to /about/service
RewriteRule "^/service$" "/about/service" [R=301]
# Temporary (302, the default for R): move /service to /about/service
RewriteRule "^/service$" "/about/service" [R]
Nginx
location = /service {
# Permanent redirect (301)
return 301 $scheme://example.com/about/service;
# Temporary redirect (302)
# return 302 $scheme://example.com/about/service;
}
# Regex-based redirect (permanent=301, redirect=302)
location ~ ^/service/offline/([a-z]+)/?$ {
rewrite ^/service/offline/([a-z]+)/?$ /service?name=$1 permanent;
}
PHP (server script)
Headers must be set before sending any output to the screen.
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: https://www.example.com/newurl');
exit();
Why It Matters for SEO
- Link equity (ranking) transfer: 301 and 308 pass the backlink value an old URL accumulated to the new URL. 302 and 307 do not, so using a 302 for a permanent move leaves the new URL without that value while the old URL keeps showing in results — a clear loss.
- Canonical signal: Google reads a 301 as a strong signal to make a URL canonical. If
rel="canonical"is a "recommendation" signal, a 301 is the "enforcement" mechanism that actually consolidates. - Lingering alternate names: Google tracks both the source and the target of a redirect. Even after a domain move, the old URL may keep appearing for a while on queries where users still trust it more — this is normal and fades over time.
- Watch for redirect chains: As hops accumulate (A→B→C), crawl efficiency and signal transfer weaken. Where possible, send A→C in a single hop.
- Distinguish from 410/404: Use 301 for a permanent move, 410 Gone for content permanently removed with no replacement, and 404 for a temporary absence. Redirecting a deleted page with a 301 to an unrelated page can be treated as a soft 404.
Implementation Checklist
- First decide whether the move is permanent or temporary — if you have no plan to reverse it, use 301 (or 308).
- Use a server-side redirect rather than JavaScript or meta refresh whenever possible.
- When you must preserve a POST body or API call, use 308 instead of 301, and 307 instead of 302.
- For a domain or site migration, map every old URL 1:1 to its corresponding new URL (avoid sending everything to the homepage).
- Collapse redirect chains into a single hop.
- After the move, use Search Console's URL Inspection to confirm what Google sees, then update and resubmit your sitemap.