Skip to content

This ends your Yave account sign-in on this device, so other Yave services you use on it will be signed out too.

SPA gives a 404 on refresh? One setting fixes it

Last updated: 2026-11-11

Contents · 6
  1. 1. Upload your build output folder
  2. 2. Check that the SPA setting is on
  3. 3. Test with a direct link and a refresh
  4. 4. Using it with a 404 page? Pick one
  5. Frequently asked questions
  6. Read next

Short answer: in Site settings > Site, open More and turn on “Open the main page for unknown addresses (for app-style sites)”; direct links and refreshes on a React or Vue site then open your app instead of a 404. Note that with it on, the “Page to show for unknown addresses” is not used for ordinary addresses, so pick the one that fits your site.

At a glance

Time needed
About 2 min
Plan required
Free plan
Coding knowledge
None
Where to do it
Editor

Step by step

  1. 1

    Upload your build output folder

    For a React, Vue or Vite site, upload the folder your build command produces (usually dist), either zipped or as a folder. These sites ship an almost empty index.html and a script draws the screen. So there is no file for an address like /about, and with the setting off, opening that address directly or refreshing it gives a 404.

    index.html
    <!doctype html><div id="root"></div><script type="module" src="/assets/index.js"></script>
  2. 2

    Check that the SPA setting is on

    Right after a ZIP, folder or GitHub import, if your files clearly look like this kind of app, the setting is turned on for you and the editor tells you. To check it yourself, go to Settings > Site settings > Site in the left rail, open More, and switch on “Open the main page for unknown addresses (for app-style sites)”. Changes save automatically and apply right away, with no need to publish again.

    The Site tab of the editor's Site settings: site language, theme color, the page to show for unknown addresses, and with More expanded, app install and the toggle to open the main page for unknown addresses
    Site settings > Site > More holds the SPA toggle
  3. 3

    Test with a direct link and a refresh

    Open your address with one of your app's routes on the end, then refresh. If your app shows up instead of a 404, you're done. Only screen-style addresses (no file extension) open the main page; a missing file with an extension, like an image or script, still returns a 404.

    myname.html2site.com/about Live

    With the toggle on, refreshing this address opens your app

  4. 4

    Using it with a 404 page? Pick one

    “Page to show for unknown addresses” is chosen in Site settings > Site from the pages on this site (leave it empty for the default 404 page). That is the right choice for ordinary multi-page sites, with the SPA toggle left off. With the toggle on, unknown addresses open the main page, so that 404 page is not used. If you want a “not found” screen inside an app, build it in your app's router.

    Site settings > Site
    Page to show for unknown addresses Default 404 page
    Open the main page for unknown addresses ON

Frequently asked questions

Why does my React app show a 404 when I refresh?

A single-page app does not have a file per address; a script in the browser reads the address and draws the screen. Static hosting looks for a file with the same name as the address, finds none for /about, and returns a 404. Turning on the SPA setting makes that address serve your main page instead, so your app takes over.

Do I have to turn the SPA setting on myself?

Right after a ZIP, folder or GitHub import it turns on automatically when your files clearly look like an app (for example an empty main page that a script fills in). When the signs are weaker, Site settings shows a suggestion with the reason under More. Either way you can switch it on or off with the toggle.

Can I leave it on for an ordinary website?

Not recommended. With it on, every mistyped address opens the main page, so your custom 404 page is never used, and search engines may treat unknown addresses as real pages. Sites that have a file per page should keep it off.

Can I still show a “page not found” screen on an SPA site?

This setting sends unknown addresses to the main page, so that screen has to come from your app's own router. If you would rather use a 404 page, turn the toggle off and choose a page under “Page to show for unknown addresses”.

I turned it on and still get a 404. Why?

First check that the file list has a main page (index.html); without it there is nothing to open, so you get a 404. Also, addresses with a file extension such as .js or .png correctly return a 404 when the file is missing, so check that the paths your app loads are right.

Trying it is faster than reading about it — paste your HTML and publish it in a minute.

Searches this workspace. Switch workspaces at the top of the sidebar.