Home / Fix guides / Broken links, errors and uptime

How to set up 301 redirects for deleted pages

When you delete a page, send its old address to the closest matching live page with a 301 (permanent) redirect, so visitors and search engines do not hit a 404 error. If there is no sensible replacement, let the old address return a clear 404 or 410 instead of forcing a redirect.

Every page on your site has an address (a URL). When you delete a page, that address does not disappear from the internet. Google still lists it, other websites still link to it, and customers still have it bookmarked or saved in old emails. Without a redirect, all of them arrive at an error page. This guide explains what to do about it in plain steps.

What the problem looks like

A visitor clicks an old link and sees "404 Not Found", "Page not found" or your theme's error page. Behind the scenes, your server answers with the status code 404, which means "nothing here".

A 301 redirect is a different answer: "this page has moved permanently, go here instead". The browser follows it automatically and the visitor lands on a working page without noticing anything.

You will usually see this problem after a redesign, a clean-up of old blog posts, a product being discontinued, a change of page names, or a move to a new platform.

Why it matters

  • Search: pages that used to rank keep appearing in results for a while, then drop out. Any authority passed on by links pointing to the deleted page is wasted if it ends in an error.
  • Sales and trust: a customer who clicks an old ad, email link or bookmark and gets an error often leaves. It also makes a business look neglected.
  • Lost links: other sites that link to you keep sending visitors to a dead end, and you never get the benefit.
  • Wasted crawling: search engines keep revisiting addresses that return errors instead of spending time on your useful pages.

A few 404s are normal and not a disaster. The ones worth fixing are deleted pages that had traffic, links or a clear replacement.

How to check if your site has it

These methods are free:

  1. Google Search Console: open the Pages report (under Indexing) and look for the reason "Not found (404)". Click it to see the list of addresses Google tried and failed to load.
  2. Your analytics: look at landing pages or page views and search for pages whose title says "Page not found". The ones with visits are your priority.
  3. A site crawler: free tools such as Screaming Frog (free version) or similar crawlers follow your internal links and list every address that returns 404.
  4. Old URLs from other sources: check your previous sitemap, old newsletters, social posts and the Internet Archive's Wayback Machine for addresses that used to exist.
  5. Test by hand: paste an old address into your browser. Or run this in a terminal and look at the first line of the answer:
curl -I https://www.example.com/old-page/

If it says 404, there is no redirect. If it says 301 and shows a location: line, the redirect exists.

SiteMonday's broken links and 404 sweep in week 6 does this kind of check across your site and puts the results in a ranked fix list, but the free methods above are enough to start.

How to fix it: the general method

  1. Make a list of deleted addresses. Put the old address in one column and the new destination in another. Use the full path, such as /blog/old-post/.
  2. Choose the destination carefully. Redirect to the page that best replaces the old one: a deleted product to a similar product or its category, an old article to a newer article on the same topic. Do not send everything to the homepage. Visitors find it confusing, and search engines may treat irrelevant redirects like a soft error (see soft 404).
  3. Use 301, not 302. A 301 is permanent. A 302 is temporary and tells search engines the old page may come back.
  4. If nothing fits, do not invent a redirect. Let the address return 404, or 410 ("gone for good") if you want to be explicit. Make your 404 page helpful, with a search box and links to key pages.
  5. Avoid chains. Point the old address straight to the final page. A to B to C slows visitors down and can lose search value.
  6. Use the full final address with the correct https:// and the version of your domain you normally use (with or without www).

How to do it on common platforms

Menu names change between versions and themes, so look for the words "redirect" or "URL mappings" if something is not exactly where described.

PlatformWhere to look
WordPressNo manual redirect tool in core. Use a redirect manager, such as the Redirection plugin, or the redirect feature in Yoast SEO Premium or Rank Math.
ShopifyOnline Store, then Navigation, then URL Redirects (may sit under Content or Settings in newer admin layouts).
WixSEO tools, then URL Redirect Manager (under Marketing or Settings, depending on your dashboard).
SquarespaceUsually Settings, then Developer Tools, then URL Mappings (newer versions may list it under Website tools). Each line looks like /old-page -> /new-page 301.
WebflowProject settings, then Hosting, then 301 redirects.
ApacheThe .htaccess file or the server configuration.
NginxThe server configuration file.

On Apache, a single redirect in .htaccess looks like this:

Redirect 301 /old-page/ https://www.example.com/new-page/

On Nginx, inside the server block:

location = /old-page/ {
    return 301 https://www.example.com/new-page/;
}

Then test the configuration with nginx -t and reload Nginx. Take a copy of the file before editing, because one typo can take the whole site down.

For step by step help, see the guides for WordPress and Apache. Guides for Shopify, Wix, Squarespace, Webflow and Nginx are also available.

How to confirm the fix worked

  • Open the old address in a private browser window. You should land on the new page, and the address bar should change.
  • Run curl -I on the old address. You want 301 with the right location: line. Then run it on the destination, which should return 200.
  • Check that the destination does not redirect again somewhere else (no chain).
  • In Google Search Console, use URL Inspection on the old address and the new one. Over the following weeks, the "Not found (404)" list should shrink. Google needs time to recrawl, so do not expect it to change overnight.
  • Run your crawler again and confirm the old addresses no longer show as errors.

How to stop it coming back

  • Add a redirect step to your deletion routine. Before deleting or renaming any page, decide where its address should point and set that up in the same sitting.
  • Check traffic and links first. If a page gets visits or has links from other sites, it deserves a proper redirect.
  • Keep your redirect list in a spreadsheet or shared document, so a future web designer does not remove it during a rebuild.
  • Plan redesigns and platform moves with a full old-to-new address map before launch, not after.
  • Take a backup before big changes, so you can restore a page if you delete the wrong one.
  • Crawl the site on a schedule. A regular check catches new 404s while they are still few. This is the purpose of the week 6 service at SiteMonday, and any monthly crawl you run yourself does the same job.

If you are not comfortable editing server files or plugins, a developer can usually set up a list of redirects quickly. Send them your spreadsheet of old and new addresses.

Step by step for your platform

Questions

What is the difference between a 301 and a 302 redirect?

A 301 tells browsers and search engines that a page has moved permanently. A 302 says the move is temporary, so use 301 for pages you have deleted or replaced for good.

Should I redirect every deleted page to my homepage?

No. Redirect each one to the most relevant replacement page. If there is no good match, it is better to let the address return a 404 or 410 than to send visitors somewhere unrelated.

Will a 301 redirect keep my search rankings?

It helps search engines understand that the new page replaces the old one, which gives the best chance of keeping the value of existing links. Results are not guaranteed and can take weeks to settle.

How long should I keep a redirect in place?

Keep it as long as the old address still receives visits or has links pointing to it. In practice that often means leaving it in place indefinitely, since redirects cost almost nothing.

Does deleting a page in WordPress create a redirect automatically?

Not for deleted pages. WordPress may redirect when you change a post's slug, but when you delete a page you need a redirect plugin or a server rule.

Is it bad to have some 404 errors on my site?

No, a few are normal, and Google does not penalise a site just for having them. Focus on deleted pages that had traffic, links or an obvious replacement.

Related problems