# Fix soft 404s

- Check 04.11 · Indexing and canonicalization · Critical
- Source: https://checklist-seo-geo.com/en/indexing-canonicalization/fix-soft-404s
- Fix soft 404s: real 404 and 410 codes on Apache, Nginx, IIS, Cloudflare, Netlify, WordPress, Shopify, Laravel, Next.js, and empty pages to flesh out.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/indexing-canonicalization/fix-soft-404s.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

A soft 404 is a page that responds `200 OK` while its content says "not found", or that is empty. Google detects it, drops it from the index and reports it under "Soft 404" in Search Console. Fixing it means making every missing page return a real 404 or 410 code, every moved piece of content redirect with a 301, and every real page display content that Google sees when rendering.

## Why it matters

The HTTP status code is the only reliable information a crawler receives before reading the page. A `200` on an error page tells it "this is valid content"; it then has to analyze the text to work out that it is not. Google does this, but with three consequences:

- **Wasted crawling**: according to Google's crawl budget guide, soft 404s keep being crawled, whereas a `404` is a strong signal not to come back.
- **Real pages dropped**: detection is based on content. A product page whose description fails to load, an empty category or a search results page with no results can be mistaken for errors and fall out of the index.
- **Poorly targeted redirects**: Google states in its site move guide that redirecting many old URLs to an unrelated destination, such as the homepage, can be treated as a soft 404.

Google lists as possible causes a missing server-side include file, a broken database connection, an empty internal search results page or a JavaScript file that failed to load.

## What it improves

- **Indexing**: real pages that were mistaken for errors return to the index once their content is visible.
- **Crawling**: removed URLs return 404 or 410 and are crawled less and less.
- **Report reliability**: real errors appear under their actual name (404, 5xx) instead of being mixed together.
- **Visitor experience**: a helpful 404 page, with navigation and search, instead of a blank page.
- **Rankings**: no direct effect on other pages; legitimate 404s do not penalize a site.

## How to check

In Search Console, open the [Page indexing report](https://search.google.com/search-console/index) and click "Soft 404". For each template that appears in the examples, inspect a URL with the [URL Inspection tool](https://search.google.com/search-console?action=inspect) and look at the screenshot and the rendered HTML.

Then test the server with an address that certainly does not exist:

```bash
curl -s -o /dev/null -w "%{http_code} %{redirect_url}\n" https://example.com/page-qui-n-existe-pas-$(date +%s)
curl -s -o /dev/null -w "%{http_code} %{redirect_url}\n" https://example.com/produits/produit-inexistant-$(date +%s)
curl -s -o /dev/null -w "%{http_code} %{redirect_url}\n" https://example.com/blog/article-inexistant-$(date +%s)
```

Expected result: `404` (or `410`) with no redirect, on every type of URL. A `200`, or a `301` or `302` to the homepage or to `/404`, reveals a soft 404.

In Screaming Frog, the custom search feature (`Configuration > Custom > Search`) lets you list pages returning 200 that contain "not found", "does not exist" or "no results".

## How to implement

### Before you start

Choose the response according to the situation:

| Situation | Response |
|---|---|
| Content removed, with no equivalent | `404` or `410`, with a helpful error page |
| Content moved or replaced by an equivalent page | `301` to the new URL |
| Real page wrongly reported (empty when rendered) | Fix how the content loads |
| Legitimate but thin page (empty category, search with no results) | Flesh it out, or `noindex`, or `404` if it has no reason to exist |

The error page itself can be well designed (clear message, menu, search, popular links): what matters is the status code. See [create a helpful 404 page](https://checklist-seo-geo.com/en/http-redirects/create-helpful-404-page) and [return 404/410 for removed content with no equivalent](https://checklist-seo-geo.com/en/http-redirects/return-404-410-removed-content-no-equivalent).

### Apache

Versions: Apache 2.4.

Declare the error page with a **local path**, in the virtual host or the `.htaccess` file:

```apache
ErrorDocument 404 /404.html
ErrorDocument 410 /410.html

# Permanently removed content
Redirect gone /ancienne-collection-2019/
RedirectMatch gone ^/promo-noel-20(1[0-9]|2[0-3])/
```

With a full URL (`ErrorDocument 404 https://example.com/404.html`), Apache sends a redirect instead of the 404 code: that is the mistake to avoid. Reload with `sudo apachectl configtest && sudo systemctl reload apache2`.

### Nginx

Versions: Nginx 1.24 and later.

```nginx
server {
    error_page 404 /404.html;
    error_page 410 /410.html;

    location = /404.html {
        internal;
    }

    location = /ancienne-collection-2019/ {
        return 410;
    }
}
```

Two configurations create soft 404s: `error_page 404 =200 /index.html;`, which turns every 404 into a 200, and `try_files $uri $uri/ /index.html;` for a single-page application that does not handle unknown routes. For a PHP application (`try_files $uri $uri/ /index.php?$args;`), the application itself must return the 404. Reload with `sudo nginx -t && sudo systemctl reload nginx`.

### IIS

Versions: IIS 10 (Windows Server 2016 to 2025).

In `web.config`:

```xml
<configuration>
  <system.webServer>
    <httpErrors errorMode="Custom" existingResponse="Replace">
      <remove statusCode="404" />
      <error statusCode="404" path="/404.html" responseMode="ExecuteURL" />
    </httpErrors>
  </system.webServer>
</configuration>
```

`responseMode="ExecuteURL"` serves the page while keeping the 404 code; `Redirect` would send a 302 redirect.

### Cloudflare

Versions: Cloudflare Pages and Workers with static assets (Wrangler 4), November 2026.

Cloudflare does not alter the origin's 404s. The risk comes from static hosting:

- **Cloudflare Pages**: without a `404.html` file at the project root, Pages treats the site as a single-page application and serves the root for any unknown path. Add a `404.html`.
- **Workers with static assets**: `not_found_handling = "single-page-application"` serves `index.html` with a `200`. For a static site, prefer this in `wrangler.toml` (same `assets.not_found_handling` key in `wrangler.jsonc`):

```toml
[assets]
directory = "./dist/"
not_found_handling = "404-page"
```

Workers then serves the nearest `404.html` with a 404 code. After the fix, purge the cache in [`Caching > Configuration`](https://dash.cloudflare.com/?to=/:account/:zone/caching/configuration).

### AWS

Versions: Amazon S3 and CloudFront consoles, November 2026.

**S3 static website hosting**: set the error document (`404.html`) in the bucket properties. **CloudFront**: under `Error pages`, a custom error response that maps a 403 or 404 error to `/index.html` with a `200` code is the usual setup for single-page applications, and a classic source of soft 404s. Keep the `404` response code, or handle unknown routes in the application.

### Netlify

Versions: `_redirects` file, all Netlify plans, November 2026.

A `404.html` file at the root of the publish directory is served automatically with a 404 code. The `/* /index.html 200` rule used by single-page applications returns 200 for any path: list the real routes before a final 404 rule in `_redirects`:

```txt
/produits/*   /index.html   200
/blog/*       /index.html   200
/*            /404.html     404
```

Under `/produits/*`, the application still has to handle products that do not exist (see "JavaScript sites without server rendering" below).

### Vercel

Versions: `vercel.json` file, all Vercel plans, November 2026.

A static `404.html`, or the framework's error page, is served with a 404 code. Avoid a global rewrite `{"source": "/(.*)", "destination": "/index.html"}` in `vercel.json` without handling unknown routes.

### Shared hosting

The `ErrorDocument` block from the Apache section works in `.htaccess`. In cPanel, the `Advanced > Error Pages` screen edits the pages served for each code; then check with `curl` that the code is still 404. Some hosts offer a "redirect 404s to the homepage" option: turn it off.

### WordPress

Versions: WordPress 6.4 to 7.1, WooCommerce 9 and 10.

WordPress returns a real 404 for a post or page that does not exist. Soft 404s come from elsewhere:

- **Plugins that redirect 404s to the homepage**: turn this option off.
- **Empty archives**: a category or tag that exists but has no posts responds 200 with "Nothing Found". Delete or fill these terms, or return 404 while they are empty, in a child theme's `functions.php` or a plugin:

```php
add_action('template_redirect', function (): void {
    if (! (is_category() || is_tag() || is_tax())) {
        return;
    }

    if (have_posts()) {
        return;
    }

    global $wp_query;

    $wp_query->set_404();
    status_header(404);
    nocache_headers();
});
```

- **Internal search**: set the results to `noindex` (Yoast SEO does this by default) and do not link to them. See [handle internal search results with no SEO value](https://checklist-seo-geo.com/en/indexing-canonicalization/handle-internal-search-results-no-seo-value).
- **WooCommerce**: a deleted product with no redirect returns 404, which is correct; redirect with a 301 to an equivalent product when one exists.

### Shopify

Versions: Shopify admin, all plans, November 2026.

Shopify returns a real 404 for a deleted product or collection. For replaced content, create a [URL redirect](https://help.shopify.com/en/manual/online-store/menus-and-links/url-redirect): `Content > Menus`, the link to view URL redirects, then create a redirect. Empty collections and products without a description are common sources of soft 404s: hide an empty collection or fill it, and keep the content, price and alternatives on an out-of-stock product page. See [manage temporarily out-of-stock products](https://checklist-seo-geo.com/en/e-commerce-seo/manage-temporarily-out-stock-products).

### PrestaShop

Versions: PrestaShop 8 and 9.

On a disabled product's page, the SEO tab offers the behavior to apply when the product is offline: no redirection (404, and 410 depending on the version) or a permanent redirect to a category or another product. Choose the 301 to a real equivalent, otherwise the 404 or the 410.

### Laravel

Versions: Laravel 10 to 13.

Return 404 from the code, never an error view with a 200 code:

```php
Route::get('/produits/{product:slug}', [ProductsController::class, 'show'])->name('products.show');

public function show(Product $product): View
{
    return view('products.show', ['product' => $product]);
}
```

Route model binding returns 404 if the slug does not exist. Elsewhere, use `Product::where('slug', $slug)->firstOrFail()` or `abort(404)`, and `abort(410)` for withdrawn content. Customize the page in `resources/views/errors/404.blade.php`. Watch out for `Route::fallback()`: the view it returns goes out with a 200 unless you specify the code, `response()->view('errors.404', [], 404)`.

### Symfony

Versions: Symfony 6.4, 7.4 and 8.x.

```php
#[Route('/produits/{slug}', name: 'product_show')]
public function show(string $slug, ProductRepository $products): Response
{
    $product = $products->findOneBy(['slug' => $slug]);

    if ($product === null) {
        throw $this->createNotFoundException();
    }

    return $this->render('product/show.html.twig', ['product' => $product]);
}
```

The error page is customized in `templates/bundles/TwigBundle/Exception/error404.html.twig`.

### Next.js

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

With the App Router, call `notFound()` when the resource does not exist:

```js
// app/produits/[slug]/page.js
import { notFound } from 'next/navigation';

export default async function Page({ params }) {
  const { slug } = await params;
  const product = await getProduct(slug);

  if (!product) {
    notFound();
  }

  return <ProductDetails product={product} />;
}
```

`notFound()` returns a 404 if it runs before the response starts, including during prerendering. When called in a component under `<Suspense>` after streaming has started, the response keeps its 200 code and Next.js adds a `noindex` tag: check that the resource exists before any streaming to get a real 404. Customize the display with `app/not-found.js`.

### Nuxt

Versions: Nuxt 4.

```js
// app/pages/produits/[slug].vue, inside <script setup>
const route = useRoute();
const { data: product } = await useFetch(`/api/products/${route.params.slug}`);

if (!product.value) {
  throw createError({ status: 404, statusText: 'Product not found', fatal: true });
}
```

With server rendering, Nuxt then returns the 404 code and the `app/error.vue` page. On a Nuxt 3 project, which is no longer maintained since July 2026, the files are in `pages/` with `error.vue` at the root, and that version's documentation uses `statusCode` and `statusMessage`.

### Astro

Versions: Astro 5 to 7.

In static mode, `src/pages/404.astro` produces a `404.html` that most hosts serve with a 404 code. With on-demand rendering (adapter installed, `export const prerender = false` in the page or `output: 'server'`):

```txt
---
const product = await getProduct(Astro.params.slug);

if (!product) {
  return new Response(null, { status: 404 });
}
---
```

### JavaScript sites without server rendering

A single-page application receives every URL on the same `index.html`. Google suggests two solutions: redirect in JavaScript to a URL for which the server returns a real 404, or add a `noindex` tag dynamically.

```js
const product = await fetch(`/api/products/${id}`).then((response) => response.ok ? response.json() : null);

if (!product) {
  const meta = document.createElement('meta');
  meta.name = 'robots';
  meta.content = 'noindex';
  document.head.appendChild(meta);
}
```

See [check SPA HTTP status codes](https://checklist-seo-geo.com/en/javascript-html-rendering/check-spa-http-status-codes). Server rendering, when possible, fixes the problem at its root.

### Real pages wrongly reported

If the URL is a real page, open URL Inspection, then "Test live URL" and "View tested page". An empty screenshot or an error message means the content did not load for Googlebot: resources blocked in robots.txt, a failed API call, an intermittent server error, resources that are too slow or too numerous. Fix the cause, then click "Validate fix" in the report.

## Common mistakes

- **Redirecting every unknown URL to the homepage**: Google may treat these redirects as soft 404s, and visitors are left confused. See [avoid redirecting all removed pages to the homepage](https://checklist-seo-geo.com/en/http-redirects/avoid-redirecting-all-removed-pages-homepage).
- **Redirecting to `/404`**: the error page then responds on a URL that does not exist, after a 301 or 302.
- **`ErrorDocument` with a full URL**: Apache sends a redirect instead of the 404 code.
- **Single-page application fallback rules**: `index.html` with a 200 for any path, on CloudFront, Netlify, Vercel, Cloudflare or Nginx.
- **Leaving categories or service pages empty**: they get mistaken for errors.
- **Being afraid of 404s**: a 404 on content that has really been removed is the right response and does not penalize the site.
- **Validating the fix without testing every template**: validation fails on the template you forgot.

## Frequently asked questions

### What is a soft 404 error?

A soft 404 is a page that responds with HTTP code 200, a sign of success, while its content indicates an error or it is empty: "page not found", a category with no products, a search with no results. Google detects it by analyzing the content, excludes it from the index and reports it in the Search Console Page indexing report. The fix is to return a real 404 or 410 code, or to make the real content visible.

### Should a removed page return 404 or 410?

Both are fine for removed content with no equivalent: they tell Google the page no longer exists, and the URL gradually drops out of the index. A 410 explicitly says the removal is permanent; a 404 says the page cannot be found. Choose 410 for deliberate, lasting removals and 404 by default. If equivalent content exists, a 301 redirect to it is better than either.

### Does redirecting removed pages to the homepage prevent soft 404s?

No, quite the opposite. Google states that redirecting many old URLs to an unrelated destination, such as the homepage, can be treated as a soft 404. Visitors also land on a page that does not match what they were looking for. Only redirect with a 301 to an equivalent page; with no equivalent, return a 404 or 410 code with an error page that offers navigation and search.

### Why is a real page reported as a soft 404?

Google judges a soft 404 based on the content it sees when rendering. If a product description loads through an API that fails, if a JavaScript file is blocked or if the server returns an intermittent error, Googlebot sees an empty page and takes it for an error. Test the live URL in the inspection tool and look at the screenshot: a blank page confirms a loading problem to fix.

## Resources

- [Search Console Help: Page indexing report](https://support.google.com/webmasters/answer/7440203?hl=en)
- [Google Search Central: Troubleshoot crawling errors](https://developers.google.com/search/docs/crawling-indexing/troubleshoot-crawling-errors?hl=en)
- [Google Search Central: HTTP status codes and Google Search](https://developers.google.com/search/docs/crawling-indexing/http-network-errors?hl=en)
- [Google Search Central: JavaScript SEO basics](https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics?hl=en)
- [Apache: ErrorDocument directive](https://httpd.apache.org/docs/2.4/mod/core.html#errordocument) and [Nginx: error_page](https://nginx.org/en/docs/http/ngx_http_core_module.html#error_page)
- [Cloudflare Workers: handling not-found pages](https://developers.cloudflare.com/workers/static-assets/routing/static-site-generation/)
- [Next.js: notFound](https://nextjs.org/docs/app/api-reference/functions/not-found) and [Laravel: HTTP errors](https://laravel.com/docs/errors#http-exceptions)

Next steps: [Check canonicals and absolute URLs](https://checklist-seo-geo.com/en/indexing-canonicalization/check-canonicals-absolute-urls) and [Manage permanently discontinued products](https://checklist-seo-geo.com/en/e-commerce-seo/manage-permanently-discontinued-products).
