
In this article
- The short answer
- What each one tells Google
- When to use a 301
- When to use a 302 (or 307)
- How to set up a redirect
- Step 1: check what you have now
- Step 2: send each old page to its closest match
- Step 3: avoid chains and loops
- Step 4: update everything that points to the old address
- Watch out for hidden redirects
- Common questions
- Check your own site now
When you move a page, rename an address or switch to a new domain, you need to send visitors and search engines to the new place. That is a redirect. The two you will meet most often are the 301 and the 302, and choosing the wrong one can quietly cost you search traffic.
This applies to every platform, whether your site runs on WordPress, Shopify, Wix, Squarespace, Webflow or custom code. The codes are part of the web itself, not of any one tool.
The short answer
- 301 (moved permanently): the old address is gone for good. Use it for almost every move, rename or merge.
- 302 (found, temporary): the old address will come back. Use it only for short-term changes, such as a sale page or maintenance.
If you are not sure, you almost certainly want a 301.
What each one tells Google
A 301 says "treat the new address as the real one". Google passes the old page's ranking signals to the new address and, over time, shows the new address in search results. A 302 says "keep the old address, this is only a detour". Google tends to keep the old address indexed, which is wrong if the move is really permanent.
Google says it can eventually treat a long-lasting 302 like a 301, but that is slow and not guaranteed. Do not rely on it.
When to use a 301
- You changed a page address or its folder structure.
- You moved from
http://tohttps://; see how to fix an SSL certificate problem for the certificate side. - You moved to a new domain or merged two sites.
- You are picking one version of the address, with or without
www, with or without a trailing slash. This also helps with duplicate content. - You deleted a page that has a close replacement.
When to use a 302 (or 307)
- A temporary sale, campaign or event page that will return to normal.
- Short maintenance, where you send visitors to a holding page.
- Testing a new page for a limited time.
You may also see 307 and 308. They work like 302 and 301, with one extra rule: the visitor's request method (for example a form POST) is kept. For ordinary page links, 301 and 302 are what matter.
How to set up a redirect
- Platform or plugin: most website builders and SEO plugins have a "redirects" screen where you enter the old and new address and choose the type.
- Server rules: on Apache use
Redirect 301 /old-page /new-pagein.htaccess. Nginx and other servers have their own syntax. The redirect rule generator writes the code for you. - Page-level code: only as a last resort, because the server has to load the page first.
Step 1: check what you have now
Paste an address into the redirect checker. It shows each hop, the status code at every step and the final address, so you can see at a glance whether a move is a 301 or a 302.
Step 2: send each old page to its closest match
Point the old address at the new page that covers the same topic. Sending everything to the home page looks like a soft 404 to Google and wastes the old page's value. If there is truly no match, let it return a proper error and see how to build a custom 404 page.
Step 3: avoid chains and loops
- Chains: A goes to B, B goes to C. Each hop slows the page and loses a little signal. Update the old rule so A goes straight to C.
- Loops: A goes to B and B goes back to A. The browser gives up with an error. Read how to fix "too many redirects".
Step 4: update everything that points to the old address
- Change your own links to the new address; see internal linking and how to find broken links.
- Update your XML sitemap so it lists only final addresses.
- Keep the redirects in place for at least a year, longer for pages with many links from other sites.
Watch out for hidden redirects
If visitors from Google land on an unfamiliar or spammy site while you see your own page normally, your site may carry a malicious redirect. It often hides in .htaccess, a plugin or a theme file. Read how to check if your website is hacked and what website cloaking is.
Common questions
Does a 301 lose ranking power?
Google has said that 301 redirects no longer lose ranking value in the way people used to fear. Keep chains short and point to a relevant page.
Can I use a 302 for a permanent move?
It may work eventually, but it is slower and riskier. Use a 301 when the move is permanent.
How long should I keep a 301?
At least a year. Removing it earlier can bring back errors for people and for search engines that still use the old address.
Do redirects slow my site?
Each hop adds a small delay, so keep them to one. See how to speed up your website.
Free tools for this problem
- Redirect checker: Trace every hop of up to 10 URLs.
- Redirect rules generator: Force HTTPS, set www or non-www and map old pages to new for Apache and nginx.
- HTTP status and header viewer: Status code, response headers, redirects, compression and caching.
