Home page is working but other pages give "broken link or entered a URL that doesn't exist on this site" - index.html IS present at top level

Hi - I know there have been many many posts about this issue and I have read through most of the old material on the topic and I have been unable to resolve this issue.

This is my second time deploying a react app with Netlify and I have been comparing this current project with my previous successful one to try to figure out the difference.

My homepage loads and works fine but all other pages give this error:

"Page Not Found

Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site."

I have downloaded the deploy file and can see my index.html file at the top level.

Netlify site, github repo and latest deploy log below.

Thanks in advance for your help.

Ed

Netlify site: https://zippy-begonia-4431f2.netlify.app

Github repo: https://github.com/ed-coleman/hil.aked.frontend

Deploy log:

12:22:10 PM: build-image version: 31a7e9b9b9241b13dbf7b10680a6ac9f4fd4e9a7 (focal)
12:22:10 PM: buildbot version: 31a7e9b9b9241b13dbf7b10680a6ac9f4fd4e9a7
12:22:10 PM: Fetching cached dependencies
12:22:10 PM: Starting to download cache of 77.9MB
12:22:11 PM: Finished downloading cache in 423ms
12:22:11 PM: Starting to extract cache
12:22:11 PM: Finished extracting cache in 574ms
12:22:11 PM: Finished fetching cache in 1.033s
12:22:11 PM: Starting to prepare the repo for build
12:22:11 PM: Preparing Git Reference refs/heads/main
12:22:12 PM: Parsing package.json dependencies
12:22:14 PM: Starting to install dependencies
12:22:14 PM: Python version set to 3.8
12:22:14 PM: Attempting Ruby version 2.7.2, read from environment
12:22:14 PM: Using Ruby version 2.7.2
12:22:15 PM: Started restoring cached go cache
12:22:15 PM: Finished restoring cached go cache
12:22:15 PM: Installing Go version 1.19.5 (requested 1.19.5)
12:22:20 PM: go version go1.19.5 linux/amd64
12:22:21 PM: Using PHP version 8.0
12:22:21 PM: Started restoring cached Node.js version
12:22:22 PM: Finished restoring cached Node.js version
12:22:22 PM: v16.20.0 is already installed.
12:22:23 PM: Now using node v16.20.0 (npm v8.19.4)
12:22:23 PM: Enabling Node.js Corepack
12:22:23 PM: Started restoring cached build plugins
12:22:23 PM: Finished restoring cached build plugins
12:22:23 PM: Started restoring cached corepack dependencies
12:22:23 PM: Finished restoring cached corepack dependencies
12:22:23 PM: No npm workspaces detected
12:22:23 PM: Started restoring cached node modules
12:22:23 PM: Finished restoring cached node modules
12:22:23 PM: Installing npm packages using npm version 8.19.4
12:22:24 PM: up to date, audited 167 packages in 472ms
12:22:24 PM: 13 packages are looking for funding
12:22:24 PM: run npm fund for details
12:22:24 PM: found 0 vulnerabilities
12:22:24 PM: npm packages installed
12:22:24 PM: Install dependencies script success
12:22:24 PM: Starting build script
12:22:25 PM: Detected 1 framework(s)
12:22:25 PM: β€œvite” at version β€œ4.2.1”
12:22:25 PM: Section completed: initializing
12:22:26 PM: ​
12:22:26 PM: Netlify Build
12:22:26 PM: ────────────────────────────────────────────────────────────────
12:22:26 PM: ​
12:22:26 PM: ❯ Version
12:22:26 PM: @netlify/build 29.9.2
12:22:26 PM: ​
12:22:26 PM: ❯ Flags
12:22:26 PM: baseRelDir: true
12:22:26 PM: buildId: 643fcedc20fd0400086a0e19
12:22:26 PM: deployId: 643fcedc20fd0400086a0e1b
12:22:26 PM: ​
12:22:26 PM: ❯ Current directory
12:22:26 PM: /opt/build/repo
12:22:26 PM: ​
12:22:26 PM: ❯ Config file
12:22:26 PM: No config file was defined: using default values.
12:22:26 PM: ​
12:22:26 PM: ❯ Context
12:22:26 PM: production
12:22:26 PM: ​
12:22:26 PM: 1. Build command from Netlify app
12:22:26 PM: ────────────────────────────────────────────────────────────────
12:22:26 PM: ​
12:22:26 PM: $ npm run build
12:22:27 PM: > hil-s-website@0.0.0 build
12:22:27 PM: > vite build
12:22:27 PM: vite v4.2.1 building for production…
12:22:27 PM: transforming…
12:22:30 PM: βœ“ 673 modules transformed.
12:22:30 PM: rendering chunks…
12:22:30 PM: computing gzip size…
12:22:30 PM: dist/index.html 0.45 kB
12:22:30 PM: dist/assets/index-cb1600eb.css 3.47 kB β”‚ gzip: 1.39 kB
12:22:30 PM: dist/assets/index-94fa46b0.js 346.71 kB β”‚ gzip: 109.20 kB
12:22:30 PM: βœ“ built in 3.48s
12:22:31 PM: ​
12:22:31 PM: (build.command completed in 4.1s)
12:22:31 PM: ​
12:22:31 PM: Starting post processing
12:22:31 PM: 2. Deploy site
12:22:31 PM: ────────────────────────────────────────────────────────────────
12:22:31 PM: ​
12:22:31 PM: Post processing - HTML
12:22:31 PM: Starting to deploy site from β€˜dist’
12:22:31 PM: Calculating files to upload
12:22:31 PM: 1 new files to upload
12:22:31 PM: 0 new functions to upload
12:22:31 PM: Section completed: deploying
12:22:31 PM: Post processing - header rules
12:22:31 PM: Site deploy was successfully initiated
12:22:31 PM: ​
12:22:31 PM: (Deploy site completed in 161ms)
12:22:31 PM: Post processing - redirect rules
12:22:31 PM: ​
12:22:31 PM: Netlify Build Complete
12:22:31 PM: ────────────────────────────────────────────────────────────────
12:22:31 PM: Post processing done
12:22:31 PM: ​
12:22:31 PM: (Netlify Build completed in 4.3s)
12:22:31 PM: Caching artifacts
12:22:31 PM: Section completed: postprocessing
12:22:31 PM: Started saving node modules
12:22:31 PM: Finished saving node modules
12:22:31 PM: Started saving build plugins
12:22:31 PM: Finished saving build plugins
12:22:31 PM: Started saving corepack cache
12:22:31 PM: Finished saving corepack cache
12:22:31 PM: Started saving pip cache
12:22:31 PM: Finished saving pip cache
12:22:31 PM: Started saving emacs cask dependencies
12:22:31 PM: Finished saving emacs cask dependencies
12:22:31 PM: Started saving maven dependencies
12:22:31 PM: Finished saving maven dependencies
12:22:32 PM: Site is live :sparkles:
12:22:31 PM: Started saving boot dependencies
12:22:31 PM: Finished saving boot dependencies
12:22:31 PM: Started saving rust rustup cache
12:22:31 PM: Finished saving rust rustup cache
12:22:31 PM: Started saving go dependencies
12:22:31 PM: Finished saving go dependencies
12:22:32 PM: Build script success
12:22:32 PM: Section completed: building
12:22:32 PM: Uploading Cache of size 77.9MB
12:22:33 PM: Section completed: cleanup
12:22:33 PM: Finished processing build request in 22.907s

The other pages appear to work now. You managed to fix the issue @edcoleman ?

1 Like

Hi - sorry for the late reply but yes I was able to fix this myself.

For anyone else with the same problem this video was all I needed was to set up a .toml file with the following code in it:

[[redirects]]
from = '/*'
to = 'index.html'
status = 200
1 Like

thanks for sharing and updating the thread!