Check 20.17 · E-commerce SEO

Manage permanently discontinued products

Decide for each discontinued product: a 301 to an equivalent, a page kept with its successor, or a 404/410, then apply it on the server, the CMS and the feeds.

Priority
Critical
Difficulty
Intermediate
Estimated time
1 h to 2 days depending on volume
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

A permanently discontinued product will not come back into stock: its page cannot stay as it is. This check means choosing, product by product, between three outcomes: a 301 redirect to a genuinely equivalent replacement, keeping the page with a “no longer sold” notice and links to its successors when it remains useful, or removing it with a 404 or 410 status code. Then cleaning up internal links, the sitemap and the feeds. Once it is done, no visitor lands on a ghost product and no earned link goes to waste.

Why it matters

Discontinued product pages pile up quickly in a catalog that keeps turning over. Left online as if nothing had happened, they disappoint visitors, clutter the index and end up in AI assistants' answers as available products. Deleted without thought, they take with them their rankings, their backlinks and sometimes information customers still need (manuals, spare parts).

Google documents the two main paths. For a page that has moved, it recommends a permanent server-side redirect (301 or 308). For a page removed with no replacement, a 404 is not a problem. Google treats 404 and 410 the same way: the URL drops out of the index and its crawling gradually slows down.

The common trap is redirecting everything that disappears to the homepage or a general category. Visitors do not find what they were looking for, and a page that does not match the request may be treated as a soft 404. See avoid redirecting all removed pages to the homepage (opens in a new tab).

What it improves

  • Links and rankings preserved when a replacement takes over the page through a 301.
  • A clean index Fewer dead product pages, fewer soft 404s.
  • Crawling Fewer requests on pages with no future. Noticeable on large catalogs.
  • Experience The visitor finds the successor or the after-sales information.
  • AI answers and feeds No more discontinued products presented as available.

How to check

  1. List of discontinued products: export from the back office the products that are disabled, deleted or at zero stock for more than N months with no restock planned.
  2. HTTP status code of their URLs:
while read -r url; do
  printf "%s %s\n" "$(curl -s -o /dev/null -w '%{http_code} %{redirect_url}' "$url")" "$url"
done < produits-retires.txt

Look for 200s with no discontinuation notice, 302s (temporary), redirects to the homepage, and chains.

  1. Search Console: Page indexing, reasons “Soft 404” and “Not found (404)”; check that the 404s listed are intended.
  2. Value of the URLs: clicks over 12 months in the Performance report, external links (Search Console Links report, or Ahrefs, Semrush, Majestic).
  3. Internal links and sitemap: a Screaming Frog crawl lists internal links to URLs that return a 404 or redirect.

How to implement

Before you start

Build the decision table. Example for Thé des Lisières, a fictional shop:

URL Clicks (12 months) Referring domains Equivalent replacement After-sales content Decision Target
/produits/theiere-fonte-06/ 1,200 8 Cast-iron teapot 0.6 L v2 No 301 /produits/theiere-fonte-06-v2/
/produits/bouilloire-tempo/ 300 3 No Manual, replacement seal Page kept, “no longer sold” notice —
/produits/sencha-printemps-2023/ 40 0 Sencha from the current harvest No 301 /produits/sencha-printemps/
/produits/coffret-noel-2022/ 2 0 No No 410 —

Criteria:

  1. 301 to a product: the replacement meets the same need (new version, same product under a new reference, following vintage).
  2. 301 to a category: only if it presents products that fulfill the same function and the original query finds its answer there.
  3. Page kept: significant traffic or links with no replacement, or information that is still useful (manual, compatibility, parts). The page keeps its content, displays “This product is no longer sold” at the top, suggests successors, removes the buy button, and its markup switches to "availability": "https://schema.org/Discontinued".
  4. 404 or 410: no replacement and no lasting value. Prefer 410 if your platform allows it, for clarity; for Google, the effect is the same.

After each decision:

  • Internal links: replace them with the target or remove them. See fix broken internal links (opens in a new tab).
  • Sitemap: remove URLs that redirect or return 404/410; a page that is kept and indexable can stay in it.
  • Merchant Center and other feeds: remove the item from the feed.
  • Guides and comparisons: update any mentions of the product.

Apache

Versions Apache 2.4.

In the root .htaccess or the virtual host:

Redirect 301 /produits/theiere-fonte-06/ https://example.com/produits/theiere-fonte-06-v2/
Redirect 301 /produits/sencha-printemps-2023/ https://example.com/produits/sencha-printemps/
Redirect gone /produits/coffret-noel-2022/

For several hundred URLs, a RewriteMap table in the server configuration (not available in .htaccess) avoids an endless file. Test with apachectl configtest, then reload.

Nginx

Versions Nginx 1.18 and later.

In the http block, a mapping table, then its use in the server block:

map $uri $retired_product_target {
    default "";
    /produits/theiere-fonte-06/ https://example.com/produits/theiere-fonte-06-v2/;
    /produits/sencha-printemps-2023/ https://example.com/produits/sencha-printemps/;
}

map $uri $retired_product_gone {
    default 0;
    /produits/coffret-noel-2022/ 1;
}
server {
    if ($retired_product_target) {
        return 301 $retired_product_target;
    }

    if ($retired_product_gone) {
        return 410;
    }
}

Place both if blocks at the top of the server block, then run sudo nginx -t && sudo systemctl reload nginx.

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

For large volumes without touching the server, use Bulk Redirects (the Bulk Redirects page at account level, or Rules > Settings, Bulk Redirects tab, at zone level): a list of source and target URLs, then a rule that enables it. For a few URLs, Rules > Overview > Create rule > Redirect Rule (rules overview). The 404 and 410 status codes still have to be produced by the origin.

Shared hosting

Apply the directives from the Apache section in .htaccess. On cPanel, the Domains > Redirects tool creates 301s without editing the file; it does not produce 410s, which you add by hand with Redirect gone.

WordPress

Versions WordPress 6.7 and later, WooCommerce 9 to 11, Redirection plugin 5.

With WooCommerce:

  • Page kept: leave the product published, with the stock status “Out of stock”, remove it from featured categories, add the discontinuation notice and the successors at the top of the description, and hide the buy button through the template.
  • Redirect or 410: move the product to the trash (its URL then returns a 404), then create the 301 redirect or the 410 response with the Redirection plugin (Tools > Redirection; for a removal, an error action with HTTP code 410) or with your SEO plugin's redirect module.

Shopify

Versions Shopify admin, all plans, November 2026.

Shopify cannot return a 410. A deleted product, or one set to draft, returns a 404; a redirect only works on a URL that no longer loads a valid page. For a 301: set the product to draft or delete it, then Content > Menus > View URL redirects > Create URL redirect, or import a CSV file for a batch. To keep the page, leave the product active, with zero stock and selling when out of stock disabled, and add the discontinuation notice.

PrestaShop

Versions PrestaShop 8 and 9 (display options since 8.1).

On the product page, in the SEO tab, choose the “Redirection when offline”: 301 or 302 to a product or a category, 404 or 410; since PrestaShop 8.1, you can also keep displaying the page (with a 200, or with a 404 or 410 code) or fall back to the store's default behavior. Then disable the product. Choose a 301 to a specific product rather than to the default category.

Magento

Versions Magento Open Source and Adobe Commerce 2.4 (2.4.7 to 2.4.9).

Disable the product (Enable Product set to “No”): its URL returns a 404. For a 301, Marketing > SEO & Search > URL Rewrites > Add URL Rewrite, type “For product” or “Custom”, request path, target path, redirect type “Permanent (301)”. 410 responses require an extension or a rule on the web server.

Laravel

Versions Laravel 11 to 13.

Route::permanentRedirect('/produits/theiere-fonte-06', '/produits/theiere-fonte-06-v2');

For a catalog, a retired_products table (path, target, status) checked before the 404:

Route::fallback(function (Request $request) {
    $retired = RetiredProduct::where('path', $request->getPathInfo())->first();

    if (! $retired) {
        abort(404);
    }

    if ($retired->target) {
        return redirect($retired->target, 301);
    }

    abort(410);
});

Next.js

Versions Next.js 15 and 16 (App Router).

Permanent redirects are declared in next.config.js; permanent: true returns a 308, which Google also treats as permanent:

module.exports = {
  async redirects() {
    return [
      {
        source: '/produits/theiere-fonte-06',
        destination: '/produits/theiere-fonte-06-v2',
        permanent: true,
      },
    ];
  },
};

notFound() produces a 404. For a 410, intercept the request before rendering and return new Response(null, { status: 410 }): the file name depends on the version.

Next.js 16

The middleware.ts file is deprecated and renamed proxy.ts, at the project root (or in src), with a proxy function:

import type { NextRequest } from 'next/server';

const retiredPaths = new Set(['/produits/coffret-noel-2022']);

export function proxy(request: NextRequest) {
  if (retiredPaths.has(request.nextUrl.pathname)) {
    return new Response(null, { status: 410 });
  }
}

export const config = {
  matcher: '/produits/:path*',
};

The npx @next/codemod@canary middleware-to-proxy . codemod renames an old file.

Next.js 15

Same code in middleware.ts, with a function named middleware:

import type { NextRequest } from 'next/server';

const retiredPaths = new Set(['/produits/coffret-noel-2022']);

export function middleware(request: NextRequest) {
  if (retiredPaths.has(request.nextUrl.pathname)) {
    return new Response(null, { status: 410 });
  }
}

export const config = {
  matcher: '/produits/:path*',
};

Common mistakes

  • Redirecting everything to the homepage or to an unrelated category.
  • 302 redirects left in place for a permanent removal.
  • Redirect chains: product v1 redirects to v2, which has itself been discontinued and redirects to v3. Point v1 directly to v3. See fix redirect chains (opens in a new tab).
  • Pages kept without a discontinuation notice and with an active buy button.
  • Deleting product pages that received backlinks without a redirect, when an equivalent exists.
  • Discontinued products still in the Merchant Center feed or in the sitemap.
  • Deleting after-sales information that customers still need.

Frequently asked questions

Should you redirect a product that is no longer sold?

Only to a real equivalent: a new version, the same product under a new reference, or a category presenting products that fulfill the same function. In that case, a 301 redirect passes on the page and its links. With no equivalent, return a 404 or a 410, or keep the page with a “no longer sold” notice if it still has traffic, links or useful information.

404 or 410 for a deleted product?

For Google, both codes have the same effect: the URL is removed from the index and its crawling gradually slows down. A 410 states more clearly that the removal is deliberate and permanent, so use it if your platform allows it. Shopify, for example, only returns 404s for a deleted product. In both cases, remove the URL from the sitemap and from internal links.

Can discontinued products be redirected to the homepage?

No. A redirect to the homepage does not answer the search of a visitor who was looking for a specific product, and a page unrelated to the request may be treated by Google as a soft 404. Redirect to the replacement or to a genuinely equivalent category; otherwise let the URL return a 404 or 410 with a helpful error page.

When should you keep a discontinued product's page online?

Keep it when it still receives traffic or links and no replacement exists, or when it contains information useful to customers: manuals, compatibility, spare parts. Display “This product is no longer sold” at the top, suggest successors, remove the buy button and switch the markup's availability to Discontinued. Remove the item from merchant feeds.

Updated on

Topic checklist (PDF)

And now?

In the “E-commerce SEO” topic

  1. Optimize categories and subcategories
  2. Optimize product pages with original descriptions
  3. Avoid duplicated manufacturer descriptions
  4. Display specifications, dimensions and materials
  5. Display compatibility information
  6. Display available SKU, GTIN or MPN
  7. Display brand, price and currency
  8. Display actual availability
  9. Display shipping costs and delivery times
  10. Display return policies and warranties
  11. Add authentic reviews and Q&A
  12. Add original images and size guides
  13. Publish buying guides and comparisons
  14. Suggest relevant complementary products
  15. Manage variants
  16. Manage temporarily out-of-stock products
  17. Manage permanently discontinued products
  18. Control indexing of facets and internal search
  19. Implement Product, ProductGroup and Offer
  20. Implement compatible shipping and return markup
  21. Set up Merchant Center and free listings
  22. Set up Microsoft Merchant Center if relevant
  23. Monitor feed errors
  24. Sync prices and stock across site, feeds and markup
  25. Check eligible AI shopping features
  26. Check marketplaces
  27. Test AI product recommendations