301 redirect: when to use it and how to set it up without losing SEO
You renamed your star product so it would sound better, updated its URL and, a week later, visits from Google plummeted. Customers who had it bookmarked land on an error page and the links you worked hard to earn point to nothing. In almost every case the same thing is missing: a 301 redirect.
Used well, a 301 redirect lets you change URLs, merge products, or migrate platforms while keeping visits and signals. Used badly, it creates chains, loops, and pages Google doesn't know where to put. Here's when to use it, when not to, and how to do it in WordPress and in .htaccess.
In short:
- A 301 indicates a permanent move and is a strong signal for Google to show the new URL.
- A 302 is temporary: use it only if you're going to reverse the change.
- If a product sells out but will come back, don't redirect it; if it disappears with no replacement, a 404 or 410 is correct.
- Always redirect to the final destination: no chains or loops.
- Keep redirects for at least a year and, in a store, ideally forever.
301 redirect meaning: what it tells Google
A 301 redirect ("Moved Permanently") is the way your server says: "this page now lives at another address, and it's final". The visitor reaches the new URL without doing anything, and search engines update their records.
According to Google's guide on redirects and Search, permanent redirects are a strong signal that the destination should be the canonical URL, the one that appears in results. A 308 is treated the same as a 301. Google recommends using server-side permanent redirects whenever possible; meta refresh and JavaScript are for when there's no other option, and in the case of JavaScript, Google might not see it if rendering fails.
A redirect is one of the strongest signals for consolidating URLs; when you need two pages to keep existing, the right tool is the canonical tag.
301 redirect vs 302 (and when to use a 404 or 410)
| Code | Meaning | Use it in your store when… | What Google does |
|---|---|---|---|
| 301 / 308 | Permanent move | You change a URL, merge products, or migrate | Strong signal: the destination becomes the canonical |
| 302 / 307 | Temporary change | A promotion or maintenance you'll reverse | Weak signal: it may keep the original URL |
| 404 | Not found | The page doesn't exist and has no replacement | If it was indexed, it removes it from the index |
| 410 | Gone | You want to make clear it won't come back | Treats all 4xx errors the same, except 429 |
301 or 302? Ask yourself whether you're going to undo the change. If the answer is no, it's a 301. It's easy to create a 302 by accident: for example, Apache's Redirect directive responds with a 302 if you don't specify the code. Then comes the question of why Google keeps showing the old URL.
Real cases in a store: what to do in each one
A temporarily out-of-stock product
Don't redirect. Keep the product page, show that it's out of stock, offer similar products, and a back-in-stock alert. If you use structured data, mark availability as out of stock in your Product schema. That URL has already earned signals you'd lose.
A discontinued product with a successor
A 301 redirect to the new version: "6-cup moka pot" to "6-cup moka pot 2026 edition". Whoever arrives will find what they were looking for.
A deleted product with no replacement
If there's a category that solves exactly the same need, redirect there. If not, let it respond with a 404 or 410. Sending hundreds of old products to the home page doesn't help the customer or tell Google anything useful.
A slug or URL structure change
Every old URL needs its 301 to the new one. Before touching slugs that already rank, read the guide to SEO-friendly URLs: sometimes the best option is not to change them.
A platform or domain migration
Here the 301 is mandatory and massive. Google insists in its guide to moving a site with URL changes on mapping every old URL to its equivalent, redirecting straight to the final destination, and keeping redirects for at least a year. If you're thinking about switching platforms, see WooCommerce vs Shopify.
404 errors and SEO: when it's normal and when it costs you
According to Google, all 4xx errors (except 429) are treated the same: URLs that were already indexed and return a 4xx drop out of the index, and new 404s simply aren't processed. A 404 on a page that never mattered isn't a problem.
It costs you when the URL had external links, traffic, or sales. To find those URLs, check the "Not found (404)" status in Search Console's Page indexing report, your site's 404 error log, and the landing pages in your analytics. Also watch out for pages that show "not found" but respond with a 200: Google flags them as soft 404s, as we explain in why Google isn't indexing your site.
How to set up a 301 redirect in WordPress
For most stores, the safest option is a redirect manager inside WordPress instead of editing server files:
- Copy the exact old path (for example,
/product/italian-coffee-maker-6-cup/). - Enter the full destination URL.
- Choose the 301 type.
- Open the old URL in a private window and confirm you reach the right destination.
Watch out for WooCommerce's permalink settings: the WooCommerce documentation warns that changing the structure updates the URLs of every product and that old links will return 404 errors if you don't set up redirects.
SEOXtreme includes a 301 redirect manager that creates the redirect automatically when you change the slug of a page or product, and a 404 error log to spot lost URLs before they cost you sales. You can see it in WooCommerce SEO.
A 301 redirect with .htaccess (Apache servers)
If your hosting uses Apache, you can declare redirects in the .htaccess file at the root. Make a copy before editing it, because a syntax error can take the site down with a 500 error:
# Place them before the "# BEGIN WordPress" block
# 1. A product that changed URL
Redirect 301 /product/italian-coffee-maker-6-cup https://yourstore.com/product/moka-pot-6-cup
# 2. A category that was renamed (it also moves everything under it)
Redirect 301 /product-category/whole-bean-coffee https://yourstore.com/product-category/specialty-coffee
# 3. An exact match with a regular expression
RedirectMatch 301 ^/deals/?$ https://yourstore.com/promotions/
# 4. A product retired with no replacement: respond with a 410
Redirect gone /product/manual-grinder-2023-edition
According to Apache's mod_alias documentation, Redirect matches any path that starts with complete segments of the given path and appends the rest to the destination: that's why rule 2 also sends /product-category/whole-bean-coffee/page/2/ to its new equivalent, and why it's best to write source and destination without a trailing slash (the request's slash is kept). Query parameters pass through intact. If you need an exact match, use RedirectMatch. If your server is Nginx, .htaccess doesn't apply: rules go in the server configuration or in a plugin.
For a 301 redirect on Shopify, redirects are created from the admin, in the menus section, and only work from URLs that no longer exist.
Chains and loops: the silent mistakes
A chain happens when A redirects to B and B to C. Google follows up to 10 hops, according to its documentation on HTTP status codes, but each hop adds waiting time and risk of error. A loop happens when A points to B and B back to A; Search Console reports it as "Redirect error".
- Before:
/product/coffee-maker-6/→/product/italian-coffee-maker-6-cup/→/product/moka-pot-6-cup/ - After:
/product/coffee-maker-6/→/product/moka-pot-6-cup/and/product/italian-coffee-maker-6-cup/→/product/moka-pot-6-cup/
Every time you create a redirect, check whether others pointed to the URL you just moved and update them to the final destination. The same goes for your internal links: they should point straight to the new URL, not to the one that redirects.
A checklist before changing URLs or migrating
- Export all your current URLs from your sitemap, Search Console, and your analytics.
- Map old URL → new URL, one by one.
- Implement server-side 301 redirects.
- Update menus, internal links, and the sitemap with the new URLs; the guide to internal linking SEO helps you prioritize.
- Test a sample: correct status code and destination.
- Watch 404s and redirect errors over the following weeks. Google warns that visibility can fluctuate temporarily during a move.
Conclusion: change without fear, but never without a 301
A store's URLs change: products get renewed, categories get reorganized, platforms get outgrown. The 301 redirect is what lets you do it without throwing away the visits and signals you've built up.
Your next step: check your store's 404 errors today and decide, one by one, whether they deserve a 301 or can stay as they are. To continue with the technical foundation, visit the Technical SEO section.
Frequently asked questions
What is a 301 redirect?
It's a server response indicating that a URL has moved permanently to another one. The browser takes the visitor to the new address, and Google takes it as a strong signal that the destination URL should be the canonical one, meaning the one shown in results. It's used when changing URLs, merging pages, or migrating a store.
What's the difference between a 301 and a 302 redirect?
A 301 is permanent and a 302 is temporary. With a 301, Google understands that the destination should replace the old URL in its results. With a 302, the redirect is only a weak signal and Google may keep the original URL in the index. Use a 302 only for changes you're really going to reverse, such as a promotion or maintenance.
What do I do with an out-of-stock or discontinued product?
If it's coming back, don't redirect it: keep the product page published, mark it as out of stock, and offer alternatives or a back-in-stock alert. If it's discontinued and has a clear successor, use a 301 redirect to it. If it has no replacement, a 404 or 410 response is correct; sending everything to the home page only confuses the person looking for that product.
How long should I keep a 301 redirect?
As long as possible. In its guide to moving a site with URL changes, Google recommends keeping redirects for at least a year. In a store it's best to keep them indefinitely if they point to useful pages, because external links, bookmarks, and old emails keep sending visits to the old URLs for a long time.
Does a 404 error hurt my store's SEO?
A 404 on a page that really no longer exists is normal: if it was indexed, Google removes it from the index and moves on. The problem appears when that URL had links, traffic, or sales and you don't redirect it to an equivalent, because you lose those visits. Regularly check Search Console's Page indexing report and your site's 404 error log.
Sources
- Redirects and Google Search (Google Search Central)
- Site moves with URL changes (Google Search Central)
- How HTTP status codes, and network and DNS errors affect Google Search (Google Search Central)
- Apache Module mod_alias (Apache HTTP Server 2.4 Documentation)
- Permalinks (WooCommerce Documentation)
- URL redirects (Shopify Help Center)
Written and reviewed by the SEOXtreme editorial team using official sources (Google Search Central, platform documentation, and published studies). If you spot outdated information, email us at hola@vidaxtreme.com.