Free auditStart free
GuideError · CDN and hosting errors

AWS Amplify 404 Not Found

Fix a 404 on an AWS Amplify Hosting site: add the SPA rewrite rule, order redirects correctly, check wildcard syntax and confirm the build output folder.

4 min
read
5
sources
Nov 1, 2026
updated
Scaplet Editorial Team
author
In one line

On AWS Amplify Hosting a 404 usually means the requested path has no file and no rewrite rule sends it elsewhere. Single page apps need a 200 rewrite to /index.html, redirects are applied top to bottom, a rule with a bad wildcard is ignored, and a wrong baseDirectory in the build settings breaks routes. Check each in that order.

30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
02Check it

The single page app rewrite

Most SPA frameworks use history.pushState() to change the URL without a server request. That works for users who start at the root or /index.html, and "fails for users who navigate directly to any other page". The docs fix this with a 200 rewrite of everything except static file extensions.

A status of 200 makes this a rewrite: the content is served as if it came from the original address and the browser bar keeps the original URL. That is different from a 301, where the address changes. Because file extensions are excluded, a missing .js or .png still returns a real 404, which is what you want when debugging.

Amplify console JSON editor: SPA rewrite (from the AWS docs)
[
  {
    "source": "</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json|webp)$)([^.]+$)/>",
    "status": "200",
    "target": "/index.html",
    "condition": null
  }
]
03Explained

Check the build output folder

amplify.yml: baseDirectory must match your build folder
version: 1
frontend:
  phases:
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: build
    files:
      - "**/*"

The Amplify docs say that if you get access denied for certain routes with an SPA rule, "the baseDirectory might not be set correctly". If your frontend builds to build, the settings must point to build. Amplify can store build settings in the console or in an amplify.yml in your repository, and the repository file wins for the branches that have it.

04How it works

Debug it in five steps

  1. 01

    Request the exact path

    Run curl -sI https://main.d1234example.amplifyapp.com/dashboard and look at the status. A 404 on a route and a 200 on / confirms a missing rewrite.

  2. 02

    Open the rules

    In the Amplify console, open your app and its redirects and rewrites settings, then read the list top to bottom.

  3. 03

    Look for ignored rules

    Rules with more than one <*>, a <*> that is not last, or a domain plus a path in the source are ignored without an error.

  4. 04

    Check trailing slashes

    Amplify adds a trailing slash when needed for clean URLs: /about.html is served as /about when about.html returns 404, and /about/ serves /about/index.html.

  5. 05

    Redeploy and retest

    After changing build settings, run a new build and request the failing path again.

05Explained

SEO and crawler notes

A catch-all 200 rewrite means every unknown URL returns your app shell with a 200. Google says that when a 2xx page "suggests an error ... an empty page or an error message, Search Console will show a soft 404 error". If your SPA renders a not-found view, serve a real 404 for those paths with a rule of type 404 to a /404.html, and keep valid routes on the 200 rewrite. For the general meaning see 404 Not Found.

Sources · 5

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • amazon.com
  • google.com
  1. 01Setting up redirects and rewrites for an Amplify applicationdocs.aws.amazon.com · checked 2026-11-01
  2. 02Redirects and rewrites example referencedocs.aws.amazon.com · checked 2026-11-01
  3. 03Troubleshooting redirects and rewritesdocs.aws.amazon.com · checked 2026-11-01
  4. 04Configuring the build settings for an Amplify applicationdocs.aws.amazon.com · checked 2026-11-01
  5. 05How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-11-01
Questions

Asked a lot.

3 questions people ask next, answered from the sources on this page.

01How do I fix 404 on refresh in an Amplify React app?

Add a 200 rewrite that sends all non-file paths to /index.html, using the regex from the Amplify redirect examples. Put it in the redirects and rewrites settings and redeploy if needed.

02Why is my Amplify redirect ignored?

Amplify applies rules top to bottom, ignores sources with more than one <*> or a misplaced one, and ignores domain rules that contain a path. Reorder and simplify the rule.

03Is a 404 rewrite the same as a 404 status?

No. Amplify lists a 404 redirect type that shows a destination page for missing addresses, and a 200 rewrite that serves another page as if it were the original. Choose based on whether crawlers should see an error.

Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane