Get 404 on all pages except landing page

I have a site running at TrustHeart - Human & Heart, I have made some small changes and try to run my PR TrustHeart - Human & Heart but get 404 on all pages. When running locally it works fine and I have tried to deploy my main branch currently running in production to a new PR.

This issue started on Friday 2023-11-17. I’m not able to find out what’s going wrong, it seems like something not running in same manner as before, but I don’t know where to look for error. I build and deploying from Azure DevOps and there are no errors in the logs. I have tried to upload my local files manual as well but but same issue.

Is there any changes or issues in Netifly environment I should be aware of?

Hi, @knycket. The site’s netlify.toml file used to contain this:

  from = "/*"
  to = "/index.html"
  status = 200

This is commonly referred to at Netlify as the “single page application (SPA) redirect rule”. There is a support guide with more details here:

However, at some point the netlify.toml file was modified and this redirect rule was removed from that file. That is why the 404s are occurring. If you add that redirect back and trigger a new deploy, that should fix the 404s.

If not or if there are other questions, please reply anytime.

1 Like

Hi @luke

Thanks for you answer.
You pointed out the error, but I cannot understand why it goes wrong, In my package I build and deploy there is a netlify.toml with this content

  command = "yarn run build"
  functions = "functions"
  publish = "build"

  ## Uncomment to use this redirect for Single Page Applications like create-react-app.
  ## Not needed for static site generators.
  from = "/*"
  to = "/index.html"
  status = 200

But when I look at the file in Netifly is look like this.

plugins = []
headers = []
redirects = []











Somehow its over written when I deploy it to Netifly. This is the command I execute:

netlify deploy --dir=$(Pipeline.Workspace)/PulseWebReporter --alias $sitealias --site $(NETLIFYREPORTERSITEID) --auth $(NETLIFYAUTHTOKEN) --message "Deploy of PR $(System.PullRequest.PullRequestId)"

Any ideas?

Added file _redirects in public folder

/*  /index.html  200

and then it works fine.

1 Like

nice! glad to hear you found your solution!