Quick answer: a 301 redirect tells browsers and search engines that a page has moved permanently to a new address. A 302 redirect says the move is temporary and the original address will be used again. Use 301 when you change a URL for good, so search engines transfer the old page's ranking to the new one. Use 302 for short-term situations such as maintenance, tests or temporary promotions.
What a redirect is
A redirect is an instruction from a web server that says "what you asked for is over there." When your browser requests one address, the server replies with a status code in the 300 range and a new address, and the browser goes to the new one automatically.
Browser: GET https://example.com/old-page
Server: 301 Moved Permanently
Location: https://example.com/new-page
Browser: GET https://example.com/new-page
Server: 200 OK
Redirects are used when pages move, when sites change domain, to send http to https, and by short links, which are redirects by design.
301 vs. 302 at a glance
| 301 | 302 | |
|---|---|---|
| Meaning | Moved permanently | Found (moved temporarily) |
| Search engines index | The new URL | Usually the original URL |
| Ranking signals | Passed to the new URL | Kept with the original, at least initially |
| Browser caching | Cached, often for a long time | Not cached by default |
| Use for | Permanent URL changes, domain moves, HTTPS | Maintenance, A/B tests, temporary offers |
When to use a 301 redirect
Use a 301 whenever the change is meant to last.
- You changed a page's address or slug.
- You moved to a new domain.
- You merged two pages into one.
- You deleted a page and have a close replacement.
- You are forcing
httptohttps, ornon-wwwtowww. - You are standardizing trailing slashes or capital letters.
Google treats a 301 as a strong signal that the new address should replace the old one in search results.
When to use a 302 redirect
Use a 302 when the original address will come back.
- A page is temporarily unavailable or being rebuilt.
- You are testing a new version of a page with part of your traffic.
- A seasonal promotion replaces a page for a few weeks.
- You are sending visitors to a location-specific or language-specific version based on their settings.
- A product is briefly out of stock and you point to an alternative.
If a 302 stays in place for a long time, search engines may eventually treat it as permanent anyway. Do not rely on that. Pick the code that matches your intent.
What about 303, 307 and 308?
| Code | Name | Permanent | Keeps the request method | Typical use |
|---|---|---|---|---|
| 301 | Moved Permanently | Yes | Not guaranteed | Standard permanent redirect |
| 302 | Found | No | Not guaranteed | Standard temporary redirect |
| 303 | See Other | No | Changes to GET | After a form submission, to show a result page |
| 307 | Temporary Redirect | No | Yes | Temporary redirect for APIs and forms |
| 308 | Permanent Redirect | Yes | Yes | Permanent redirect for APIs and forms |
"Keeps the request method" matters when the original request was a form submission (POST). With 301 and 302, browsers may switch to a simple page request (GET) and drop the submitted data. 307 and 308 guarantee they will not.
For ordinary pages, search engines treat 308 like 301 and 307 like 302. You may also see a 307 in your browser that the server never sent: when a site uses HSTS, the browser itself upgrades http to https and reports it as an internal 307.
Reference documentation for all status codes is on MDN.
Other kinds of redirect
- Meta refresh: an instruction in the page's HTML to load another address after a delay. Slow, poor for users, and a weaker signal for search engines.
- JavaScript redirect: a script changes the location. Search engines can follow it but have to render the page first.
Server-side redirects with a proper status code are preferable to both.
Do redirects affect SEO?
Ranking signals
Google has said that 301, 302 and other 3xx redirects do not lose PageRank. The practical difference is which URL gets indexed. With a 301, the new address replaces the old. With a 302, the old one usually remains.
Redirect chains
A chain is a series of redirects: A leads to B, which leads to C, which leads to D. Each hop adds delay for visitors and work for crawlers. Google follows a limited number of hops, around ten, before giving up. Keep chains to one hop where possible by pointing A directly at D.
Redirect loops
A loop is a chain that returns to its start: A leads to B and B leads to A. Browsers stop and show ERR_TOO_MANY_REDIRECTS or "This page isn't redirecting properly."
Redirecting to irrelevant pages
Redirecting many deleted pages to the homepage is treated by Google as a "soft 404," and the old pages' value is not transferred. Redirect each old address to its closest equivalent, or let it return 404 or 410 if nothing comparable exists.
How long to keep redirects
Keep 301 redirects for at least a year, and ideally for as long as the old address has links pointing to it. Removing a redirect brings back the broken link. More on that in what link rot is.
How to check a redirect
In your browser
- Open Developer Tools (
F12, orCmd+Option+Ion Mac). - Go to the Network tab.
- Tick Preserve log.
- Load the address.
- Look at the first rows. The Status column shows 301, 302 and so on, and clicking a row shows the Location header with the next address.
With the command line
curl -sIL https://example.com/old-page
-Irequests headers only.-Lfollows redirects.-shides the progress meter.
The output lists each response in turn with its status code and Location header, ending with the final 200.
With an online redirect checker
Many free tools take a URL and display the full chain with status codes. Search for "redirect checker" or "HTTP status checker." They are convenient for checking how a link behaves from outside your own network.
In bulk
For a whole site, a crawler such as Screaming Frog lists every redirect, chain and loop. Google Search Console's Pages report shows addresses excluded as "Page with redirect."
How to check where a short link goes
A short link is a redirect to a longer address. To see the destination without opening it, use the curl command above, an online redirect checker or a link expander. This is a sensible precaution with links from unknown senders. See how to check if a link is safe.
If you create short links yourself, the same checks confirm that yours resolve in a single hop to the right page. With Link App's short links, each click is also counted, so you can see visits, visitor locations and device types. See how to shorten a URL.
How to fix "too many redirects"
As a visitor
- Clear cookies for that site. A stale cookie is the most common cause.
- Try a private window.
- Clear the browser cache. Browsers remember 301s.
- Check your device's date and time.
- Disable extensions that alter requests.
As a site owner
- Trace the loop with
curl -sILto see which addresses are involved. - Check HTTPS settings. A common loop is the server redirecting to
httpswhile a proxy or CDN in front sends requests back ashttp. With Cloudflare, set SSL mode to Full, not Flexible. - Check for conflicting rules between your server configuration, your content system and plugins: one forcing
www, another removing it. - Check the site URL settings in your content system.
- Disable redirect plugins one at a time to find the conflict.
How to set up a redirect
How you create one depends on your platform.
Apache (.htaccess)
Redirect 301 /old-page https://example.com/new-page
Nginx
location = /old-page {
return 301 https://example.com/new-page;
}
Next.js (next.config.js)
async redirects() {
return [{ source: '/old-page', destination: '/new-page', permanent: true }];
}
In Next.js, permanent: true sends a 308 and false sends a 307.
WordPress, Shopify, Wix, Squarespace: use the built-in URL redirect settings or a redirect plugin. No code is needed.
Redirect best practices
- Match the code to the intent: 301 or 308 for permanent, 302 or 307 for temporary.
- Redirect to the most relevant page, not the homepage.
- Avoid chains. Update old redirects to point at the final destination.
- Update internal links to the new address instead of relying on the redirect.
- Keep a redirect map when migrating a site.
- Test after every change.
- Keep redirects in place long term.
Frequently asked questions
What is the difference between a 301 and a 302 redirect?
A 301 is permanent and tells search engines to index the new address. A 302 is temporary and keeps the original address indexed.
Which redirect is best for SEO?
A 301 for permanent changes. It transfers the old page's signals to the new address.
Does a 302 redirect hurt SEO?
Not when used for genuinely temporary situations. Used for a permanent move, it can delay the new address being indexed.
How do I check if a URL redirects?
Use the Network tab in browser developer tools with Preserve log on, run curl -sIL with the address, or use an online redirect checker.
What is a redirect chain?
Several redirects in a row before the final page. Chains slow loading and should be shortened to a single hop.
What causes "too many redirects"?
A redirect loop, usually from conflicting HTTPS or www rules, or a stale cookie in the visitor's browser.
How long should a 301 redirect stay in place?
At least a year, and preferably permanently while any links still point to the old address.
Are short links 301 or 302 redirects?
It varies by service. Many use 301. Some use 302 or 307 so that clicks are always counted and destinations can be changed.
