Should I Use 404 or 410? Removed Pages Clean-Up Plan
Deleting old pages, products or posts? This prompt tells you which pages should get a 404, a 410, a redirect or a noindex tag, and gives you a clean step-by-step plan so Google stops wasting time on dead pages.
Example input
This is exactly what we gave the model. You replace it with your own details.
- Website: https://www.example.com - Type of site: Online store selling women's bags - CMS or platform: WordPress + WooCommerce on an Apache server - Why pages are being removed: Some products are discontinued, old sale posts are out of date, and we merged two category pages - The URLs (paste a list or describe the groups): 1. /product/red-leather-tote-2023/ 2. /product/summer-straw-bag/ 3. /product/mini-crossbody-blue/ 4. /blog/black-friday-sale-2023/ 5. /blog/eid-sale-2022/ 6. /category/hand-bags/ (merged into /category/handbags/, same products) 7. /product/test-product-123/ (a test page that got indexed by mistake) 8. /my-account/orders/ (a live customer page I don't want in Google) - Optional data per URL: backlinks, traffic in the last 12 months, and whether a close replacement page exists: #1 has 12 backlinks and 300 visits last year, and a newer version exists at /product/red-leather-tote/. #2 has 0 backlinks and 20 visits, discontinued forever, no replacement. #3 is out of stock and back in about 2 months. #4 has 5 backlinks and 50 visits; the sale is over. #5 has 0 backlinks and 0 visits. #6 to #8 have no backlinks.
Real output
Pasted straight from the model. We did not fix a word.
Removed-URL plan for www.example.com
5 quick questions (I used my best guess for each)
- Are the /category/ URLs your WooCommerce product categories, with the category base changed to "category"? My guess: yes.
- Which SEO plugin do you use? My guess: the free Yoast SEO or none, so I put the redirects in .htaccess and not in a plugin.
- Does an evergreen /black-friday/ page already exist? My guess: no, so you will create it before you turn on the redirect.
- Is the site in one language only? My guess: yes, so there is no hreflang to fix.
- Can you or your developer edit .htaccess and add a small PHP snippet? My guess: yes. You have normal Apache hosting with mod_rewrite on, and a cache plugin.
I'll carry on using these guesses. If one is wrong, tell me and I'll change the plan.
Table 1: What each URL should return
| URL or group | Action | Redirect target | Reason |
|---|---|---|---|
| 1. /product/red-leather-tote-2023/ | 301 redirect | /product/red-leather-tote/ | It's a newer version of the same bag, so the 12 backlinks and 300 visits move to the live page. |
| 2. /product/summer-straw-bag/ | 410 | — | Gone for good, with no replacement and no backlinks. 410 says "removed on purpose". |
| 3. /product/mini-crossbody-blue/ | Keep live and improve | — | It's back in about 2 months. Removing it now would throw away its rankings. |
| 4. /blog/black-friday-sale-2023/ | 301 redirect | /black-friday/ (new evergreen page) | The sale is over, but the page has 5 backlinks and 50 visits. One yearly URL collects that value every year. |
| 5. /blog/eid-sale-2022/ | 410 | — | No backlinks and no visits, so there's nothing to keep. Use one evergreen /eid-sale/ URL for future Eid sales. |
| 6. /category/hand-bags/ (plus /page/2/, /feed/ etc.) | 301 redirect | /category/handbags/ (same sub-page) | It was merged into a page with the same products, so the new page is a true replacement. |
| 7. /product/test-product-123/ | 410 | — | A test page that should never have been public. Delete it and return 410. |
| 8. /my-account/orders/ (and all of /my-account/) | Keep live + noindex | — | Customers need it, so it must keep working (200) but stay out of Google. Never 404 it or block it. |
URLs with backlinks or traffic (protect these first)
- #1 /product/red-leather-tote-2023/ (12 backlinks, 300 visits). This is your most valuable old URL. The best target is /product/red-leather-tote/ because it's the same bag. Keep this redirect forever. Before you delete the old product, copy any useful text from it to the new page.
- #4 /blog/black-friday-sale-2023/ (5 backlinks, 50 visits). The best target is a new evergreen /black-friday/ page that you update every year. Each new Black Friday then starts with these links already in place. Keep this redirect forever.
- #2 /product/summer-straw-bag/ (20 visits, no backlinks). It's not worth a redirect. There is no true replacement, and sending it to a random bag or the homepage risks a soft 404. Your 410 page should link to similar bags so these few visitors don't hit a dead end. If you add a very similar straw bag later, you can change this to a 301.
- #6 /category/hand-bags/ (no backlinks). Google already knows this page and may still rank it, so the 301 still matters.
- #3 has no traffic data, but it stays live, so nothing is lost.
Soft 404 risks to watch
A "soft 404" happens when a page looks gone but returns 200 OK, or when a removed page redirects somewhere that doesn't match. Google treats these as errors, so you get no benefit from them.
- Don't send #2, #5, #7 or future discontinued bags to the homepage or /shop/. If many removed pages point to one unrelated page, Google treats them as soft 404s, and shoppers get confused.
- Make sure your "not found" page really returns 404. Some themes, page builders and "redirect all 404s to homepage" plugins return 200 or redirect instead. Test a made-up URL such as /product/made-up-xyz/.
- WordPress "guesses" missing URLs. When a URL is not found, WordPress may redirect it to a page with a similar name, so /product/test-product-123/ could jump to a random product. The PHP snippet below turns this off.
- Keep #3 a full page while it's out of stock. If the page only says "Out of stock", Google may see it as a soft 404. Keep the photos, price, description and reviews, and add a "back soon" note. Don't set it to Draft or Private, because then it returns 404.
- An empty category that returns 200 is a soft 404. That's why the old "Hand Bags" category gets a 301 and isn't left live with no products.
- Don't leave /black-friday/ empty for 11 months. Outside the sale season, show the next sale date, an email sign-up and your current best sellers, not just "Sale over".
- Your "gone" page must return 410, not 200. The test plan below checks this.
Table 2: Clean-up checklist
The owners are my guess, so swap in real names.
| # | Task | Owner | Done |
|---|---|---|---|
| 1 | Back up the full site, the database and .htaccess. | Developer | ☐ |
| 2 | Create the evergreen /black-friday/ page. It stays live, indexable and useful all year. | Content | ☐ |
| 3 | Move all "Hand Bags" products into "Handbags", then delete the "Hand Bags" category. | Shop manager | ☐ |
| 4 | Delete products #1, #2 and #7 and posts #4 and #5, then empty the trash. | Shop manager | ☐ |
| 5 | Add the .htaccess rules, /gone.html and the PHP snippet (see the code below). | Developer | ☐ |
| 6 | #3: keep it live, set the stock status, add "back soon", a notify-me form and similar bags. | Shop manager | ☐ |
| 7 | XML sitemaps: the removed and redirected URLs are gone, and the new tote, /category/handbags/ and /black-friday/ are listed. No /my-account/ URLs. Resubmit the sitemap in Search Console. (Taking a URL out of the sitemap doesn't remove it from Google. The status codes do that.) | SEO | ☐ |
| 8 | Internal links: replace every link to #1, #2, #4, #5, #6 and #7 with the final URL. Check blog posts, product descriptions, upsells/cross-sells and buttons. | Content | ☐ |
| 9 | Menus, footer, widgets, homepage banners and sliders: no links to "Hand Bags" or Black Friday 2023. | Content | ☐ |
| 10 | Canonical tags: the new tote, /category/handbags/ and /black-friday/ each point to themselves, and no page points to a removed or redirected URL. | SEO | ☐ |
| 11 | hreflang: I guess you have none. If you use WPML or Polylang, remove the language links that point to removed URLs. | SEO | ☐ |
| 12 | Structured data: #3 shows OutOfStock (or BackOrder), breadcrumbs show "Handbags", and no Product or ItemList data points to old URLs. Check with Google's Rich Results Test. | SEO | ☐ |
| 13 | robots.txt: remove any Disallow lines for these 8 URLs or for /my-account/, and add no new ones. Google must crawl a URL to see its 301, 410 or noindex. | Developer | ☐ |
| 14 | Product feeds (Google Merchant Center, Meta catalog, if you use them): remove #1, #2 and #7, add the new tote, and set #3 to out of stock. | Shop manager / Ads | ☐ |
| 15 | Turn off any "redirect all 404s to homepage" plugin or setting. | Developer | ☐ |
| 16 | Clear your cache plugin and CDN after every change. | Developer | ☐ |
| 17 | Search Console: request indexing for the new tote, /category/handbags/ and /black-friday/. Optional: use a temporary Removal for #7 and the /my-account/ prefix to hide them faster. | SEO | ☐ |
| 18 | Optional: ask the sites that link to the old tote to update the link to the new one. | SEO | ☐ |
| 19 | Run the test plan below, then check again at 2, 4 and 8 weeks. | SEO | ☐ |
Code and settings for WordPress + WooCommerce on Apache
Step A: .htaccess. This file is in the site root. Back it up first, then paste this block above the # BEGIN WordPress line so it runs before WordPress.
# ===== SEO CLEAN-UP START - keep ABOVE "# BEGIN WordPress" =====
# Friendly page for removed items (create /gone.html - see Step B)
ErrorDocument 410 /gone.html
<IfModule mod_rewrite.c>
RewriteEngine On
# --- 301: moved for good to a true replacement ---
# 1. Old tote -> newer version of the same bag
RewriteRule ^product/red-leather-tote-2023/?$ https://www.example.com/product/red-leather-tote/ [R=301,L]
# 4. Old Black Friday post -> evergreen Black Friday page
RewriteRule ^blog/black-friday-sale-2023/?$ https://www.example.com/black-friday/ [R=301,L]
# 6. Old category + its sub-pages (page/2/, feed/) -> merged category
RewriteRule ^category/hand-bags(?:/(.*))?$ https://www.example.com/category/handbags/$1 [R=301,L]
# --- 410: gone for good, no replacement ---
# 2. Discontinued straw bag
RewriteRule ^product/summer-straw-bag/?$ - [G]
# 5. Old Eid sale post
RewriteRule ^blog/eid-sale-2022/?$ - [G]
# 7. Test product
RewriteRule ^product/test-product-123/?$ - [G]
</IfModule>
# Left out on purpose:
# 3. /product/mini-crossbody-blue/ -> stays live (200)
# 8. /my-account/ -> stays live, noindex is set in PHP (Step C)
# Never add Disallow lines for any of these URLs in robots.txt.
# ===== SEO CLEAN-UP END =====
The targets are full URLs on purpose. Someone who visits the http:// or non-www version then reaches the final page in one hop, not a chain of redirects.
Step B: create /gone.html in the site root. Keep it simple: your logo, "Sorry, this item is no longer available", and links to /category/handbags/, New Arrivals and site search. Apache sends this page with the 410 code.
Step C: PHP snippet. Add it with the free Code Snippets plugin, or in your child theme's functions.php.
// 8. Keep all My Account pages working, but tell Google not to index them.
add_action( 'template_redirect', function () {
if ( function_exists( 'is_account_page' ) && is_account_page() ) {
header( 'X-Robots-Tag: noindex, nofollow', true );
}
}, 1 );
// Stop WordPress from "guessing" a similar page for unknown URLs
// (this can turn a real 404/410 into a random redirect).
add_filter( 'do_redirect_guess_404_permalink', '__return_false' );
As far as I know, WooCommerce already adds a noindex tag to My Account pages by itself, so this snippet is a backup. If /my-account/orders/ is in Google anyway, my best guess is that robots.txt blocks it, so Google can't see the tag, or that a plugin removes the tag. Fix robots.txt first (checklist row 13).
Step D: WooCommerce settings
- #3, under Product > Inventory: set Stock status to "Out of stock", or turn on backorders ("On backorder") if you take pre-orders. Add "Back in stock around [month]" to the short description, a back-in-stock email alert, and 3–4 similar crossbody bags as Upsells.
- WooCommerce > Settings > Products > Inventory: leave "Hide out of stock items from the catalog" unchecked so your category pages still link to #3.
If you'd rather use a plugin than .htaccess: Rank Math (free) under Redirections, or Yoast SEO Premium under Redirects. Both can do 301 and 410. Use one method, .htaccess or a plugin but not both, or the rules can clash and cause loops.
Test plan
1. Header checker. Use httpstatus.io, or run curl -sIL <url> in a terminal. Test each URL with and without the trailing slash, and the http:// and non-www versions too. Redirects must be 301 (not 302), should take one hop (two at most), and must end on a 200 page.
| URL | Expected result |
|---|---|
| /product/red-leather-tote-2023/ | 301 → /product/red-leather-tote/ (200) |
| /product/summer-straw-bag/ | 410, showing your gone page |
| /product/mini-crossbody-blue/ | 200, indexable, shows "Out of stock" |
| /blog/black-friday-sale-2023/ | 301 → /black-friday/ (200) |
| /blog/eid-sale-2022/ | 410 |
| /category/hand-bags/ and /category/hand-bags/page/2/ | 301 → /category/handbags/ (and its /page/2/, if it has one) |
| /product/test-product-123/ | 410 |
| /my-account/orders/ | 200, with X-Robots-Tag: noindex in the headers or a noindex meta tag |
| /product/made-up-xyz/ | 404 (this proves your not-found page isn't a soft 404) |
2. URL Inspection in Search Console. Use "Test live URL" for each one.
- 301s: the old URL shows as a redirect. Click "Request indexing" on /product/red-leather-tote/, /category/handbags/ and /black-friday/.
- 410s: Search Console usually lists these as "Not found (404)". That's normal, because it groups 404 and 410 together.
- /my-account/orders/: after the next crawl it should show "Excluded by 'noindex' tag".
- #3: indexable, and the Product rich result shows the stock status.
3. Site crawl. Use Screaming Frog (free up to 500 URLs) or a similar tool, and check that:
- no internal links point to a 3xx, 404 or 410 URL
- there are no redirect chains or loops
- no canonical tag points to a URL that doesn't return 200
- every URL in your XML sitemap returns 200 and is indexable
- very thin pages are checked as possible soft 404s
4. Follow-up at 2, 4 and 8 weeks. In Search Console, open Indexing > Pages. The removed URLs should move to "Not found (404)" or "Page with redirect", and the "Soft 404" count should stay at zero. In Performance, the new tote should pick up the old tote's clicks.
Optional test: 410 vs 404
Honest note: you only have 3 removed URLs, so the numbers will be very small. Treat this as a rough check, or run it later when you remove more products.
- Group A (discontinued products: #2, #7 and future ones): 410, set up as above.
- Group B (old sale posts with no links: #5 and any other old sale posts): 404. Delete the
[G]line for #5 from .htaccess. The post is deleted, so WordPress then returns a normal 404. - Write down the start date. For 30–60 days, count Googlebot hits per URL in your Apache access log. Ask your host where the log is if you can't find it.
grep "Googlebot" access.log | grep -E "summer-straw-bag|test-product-123|eid-sale-2022" | awk '{print $4, $7, $9}'
This prints the date, the URL and the status code for each hit. Count the hits for each URL every week.
- Count only the real Googlebot, because fake bots copy its name. A reverse DNS lookup of the IP address should end in googlebot.com or google.com.
- What to expect: both groups leave Google's index at about the same speed. The 410 group usually gets fewer return visits from Google. Either way, old 404s don't really use up crawl budget, so this test is "nice to know", not a fix.
5-line summary for your boss or client
- We're cleaning up 8 old or unwanted URLs on example.com, so Google and shoppers only find pages that work.
- Three pages will permanently redirect to their closest live page and keep their links and visits: the old red leather tote, the 2023 Black Friday post and the old "Hand Bags" category.
- Three pages that are gone for good will return "410 Gone" so Google drops them: a discontinued straw bag, an old Eid sale post and a test page.
- The blue mini crossbody stays live while it's out of stock (back in about 2 months), and customer account pages keep working but stay hidden from Google.
- Nothing will be blocked in robots.txt or sent to the homepage; we'll also fix sitemaps, menus and links, then check the results in Search Console over the next 4–8 weeks.
The prompt
First lines open so you can see how it is built. The rest opens after purchase.
#ROLE You are a senior technical SEO consultant who has cleaned up removed pages on many large websites. Help me decide what each removed or unwanted URL on my site should return, and give me a safe clean-up plan. #INPUTS Fill in every line. Leave a line blank if you don't know it. - Website: [WEBSITE URL] - Type of site: [e.g., online store, blog, SaaS, news site] - CMS or platform: [e.g., WordPress, Shopify, custom]
How to use it
- Buy, then open it in your account.
- Copy the prompt into ChatGPT, Claude or Gemini.
- Replace the 6 inputs with your product.
- Run it. Use the output. Re-run with a different tone if you like.
Pro tips
- Paste URL groups if you have hundreds of URLs. 'All /product/*-2023/ pages' works as well as a full list.
- Add backlink counts from Search Console's Links report. The prompt uses them to decide which pages deserve a redirect.
- Run the test plan it gives you right after you deploy. A header checker catches mistakes in minutes.
Before you buy
- Will it work for my product?
- Yes, if you can fill the 6 inputs. If the output is bad with your inputs, email us: we fix the prompt and refund you.
- Do I download a file?
- No. It lives in your account with a copy button, and updates when we improve it.
- Which model is best?
- Best on Claude. Works in ChatGPT, Claude and Gemini.
Works well with this
Prompts people use in the same campaign.
More in Crawling & Indexing
Buying more than two? Lifetime is cheaper.
Every prompt, every category, forever. $59 once. Nothing to download, nothing to renew.
This prompt
$3$7
- ✓ Instant access in your account, with a copy button
- ✓ Example input and real output included
- ✓ 7-day money-back, no form
Or get every prompt, forever
Lifetime Access · $59 $149 — all categories, all future prompts, rewrites included.
Get lifetime accessCard or PayPal · taxes at checkout · nothing to download
Not the one you need?
Browse every prompt by category and sub-category.