Hi,
I have a test site neoagetech.netlify.app.
When I deployed the app for the first time, it works fine.
Then I attached my custom domain on it. The site goes to a Netlify 404 page when I do “Shift + Refresh”.
Then I thought there might be something I missed while configuring my DNS provider. So I removed the custom domain, then deleted the project and removed all related DNS records.
Then I created the project again 1 min after the deletion.
Now the site is deployed but keeps showing the 404 page regardless.
Hi Perry,
Thanks for getting back to me.
I did download my package and index.html is there. I’ve also extract it into a folder and serve the folder locally on my machine and it works fine.
Hi Perry,
It works for me now. Thanks for letting me know.
Now I’m facing another issue.
If you do " Ctrl + Shift + R" on my site again, You’ll see the same 404 page.
Hi, @johnsonlin, the 404 URL in the HAR file is this:
https://neoagetech.netlify.app/home
At Netlify, we will serve one of two files for this this URL:
/home.html
/home/index.html
Because neither of those files exist, the URLs are 404s when requested. I do see that URL working as you browse the site but that is all “client side routing” be a single-page application (SPA).
Javascript is changing of the URL in the address bar. However, no real HTTP requests happen for those URLs as you browse the site. (There might be HTTP requests but not for those specific URLs.)
When you refresh the page though, a real HTTP request is attempted and returns the 404 which is expected.
There is a solution!
The solution is to use the single-page app rule from our documentation. This is the rule below:
/* /index.html 200
Adding that redirect should fix this issue. That rules says, “If a request come in for an invalid URL, redirect that request invisibly (without changing the address in the address bar) back to the main page of the site.”
If it does not fix the issue or if there are any other questions, please let us know.
Hi Luke,
Thanks for your tip!
I just noticed that my build script didn’t copy _redirects to my dist root.
I’ve just fixed it and site should work properly now
Thank you so much Perry and Luke!
Hello there. I need help, I have tried to deploy my react sites to netlify and it works just fine on the deployment process but afterwards, the publishing was finished nevertheless my sites didn’t show up. please I’m looking forward to your help and answer.
hereby I attached the deploy log
10:44:25 PM: Waiting for other deploys from your team to complete
10:45:14 PM: Build ready to start
10:45:16 PM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
10:45:16 PM: build-image tag: v3.6.1
10:45:16 PM: buildbot version: d35018babe252245044d3565f193fa426818b4b1
10:45:16 PM: Building without cache
10:45:16 PM: Starting to prepare the repo for build
10:45:17 PM: No cached dependencies found. Cloning fresh repo
10:45:17 PM: git clone GitHub - zourdyzou/portfolio-new
10:45:18 PM: Preparing Git Reference refs/heads/main
10:45:19 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘build’ versus ‘build/’ in the Netlify UI
10:45:20 PM: Starting build script
10:45:20 PM: Installing dependencies
10:45:20 PM: Python version set to 2.7
10:45:21 PM: v12.18.0 is already installed.
10:45:22 PM: Now using node v12.18.0 (npm v6.14.4)
10:45:22 PM: Started restoring cached build plugins
10:45:22 PM: Finished restoring cached build plugins
10:45:22 PM: Attempting ruby version 2.7.1, read from environment
10:45:23 PM: Using ruby version 2.7.1
10:45:24 PM: Using PHP version 5.6
10:45:24 PM: Started restoring cached node modules
10:45:24 PM: Finished restoring cached node modules
10:45:24 PM: Installing NPM modules using NPM version 6.14.4
10:46:01 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I’ll try to do my best with it!
10:46:01 PM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
10:46:01 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
10:46:01 PM: > core-js@3.8.3 postinstall /opt/build/repo/node_modules/core-js
10:46:01 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
10:46:02 PM: > core-js-pure@3.8.3 postinstall /opt/build/repo/node_modules/core-js-pure
10:46:02 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
10:46:02 PM: > ejs@2.7.4 postinstall /opt/build/repo/node_modules/ejs
10:46:02 PM: > node ./postinstall.js
10:46:05 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
10:46:05 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:46:05 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
10:46:05 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:46:05 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules/fsevents):
10:46:05 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:46:05 PM: added 1959 packages from 762 contributors and audited 1965 packages in 40.325s
10:46:07 PM: 126 packages are looking for funding
10:46:07 PM: run npm fund for details
10:46:07 PM: found 0 vulnerabilities
10:46:07 PM: NPM modules installed
10:46:08 PM: Started restoring cached go cache
10:46:08 PM: Finished restoring cached go cache
10:46:08 PM: go version go1.14.4 linux/amd64
10:46:08 PM: go version go1.14.4 linux/amd64
10:46:08 PM: Installing missing commands
10:46:08 PM: Verify run directory
10:46:10 PM:
10:46:10 PM: ────────────────────────────────────────────────────────────────
10:46:10 PM: Netlify Build
10:46:10 PM: ────────────────────────────────────────────────────────────────
10:46:10 PM:
10:46:10 PM: ❯ Version
10:46:10 PM: @netlify/build 9.0.0
10:46:10 PM:
10:46:10 PM: ❯ Flags
10:46:10 PM: deployId: 601d67d98bacca0729330287
10:46:10 PM: mode: buildbot
10:46:10 PM:
10:46:10 PM: ❯ Current directory
10:46:10 PM: /opt/build/repo
10:46:10 PM:
10:46:10 PM: ❯ Config file
10:46:10 PM: No config file was defined: using default values.
10:46:10 PM:
10:46:10 PM: ❯ Context
10:46:10 PM: production
10:46:10 PM:
10:46:10 PM: ────────────────────────────────────────────────────────────────
10:46:10 PM: 1. Build command from Netlify app
10:46:10 PM: ────────────────────────────────────────────────────────────────
10:46:10 PM:
10:46:10 PM: $ npm run build
10:46:10 PM: > portfolio-new@0.1.0 build /opt/build/repo
10:46:10 PM: > react-scripts build
10:46:12 PM: Creating an optimized production build…
10:46:34 PM: Compiled successfully.
10:46:34 PM:
10:46:34 PM: File sizes after gzip:
10:46:34 PM: 93.24 KB build/static/js/2.37e946ee.chunk.js
10:46:34 PM: 18.15 KB build/static/css/main.1d4aa7b1.chunk.css
10:46:34 PM: 11.44 KB build/static/js/main.087751ec.chunk.js
10:46:34 PM: 1.59 KB build/static/js/3.3195852b.chunk.js
10:46:34 PM: 1.18 KB build/static/js/runtime-main.ad547383.js
10:46:34 PM: The project was built assuming it is hosted at /zourdycodes/portfolio-new.
10:46:34 PM: You can control this with the homepage field in your package.json.
10:46:34 PM: The build folder is ready to be deployed.
10:46:34 PM: Find out more about deployment here:
10:46:34 PM: Deployment | Create React App
10:46:34 PM:
10:46:34 PM: (build.command completed in 24.8s)
10:46:34 PM:
10:46:34 PM: ────────────────────────────────────────────────────────────────
10:46:34 PM: 2. Deploy site
10:46:34 PM: ────────────────────────────────────────────────────────────────
10:46:34 PM:
10:46:34 PM: Starting to deploy site from ‘build’
10:46:34 PM: Creating deploy tree
10:46:35 PM: Creating deploy upload records
10:46:35 PM: 0 new files to upload
10:46:35 PM: 0 new functions to upload
10:46:35 PM: Site deploy was successfully initiated
10:46:35 PM:
10:46:35 PM: (Deploy site completed in 137ms)
10:46:35 PM:
10:46:35 PM: ────────────────────────────────────────────────────────────────
10:46:35 PM: Netlify Build Complete
10:46:35 PM: ────────────────────────────────────────────────────────────────
10:46:35 PM:
10:46:35 PM: (Netlify Build completed in 25s)
10:46:35 PM: Starting post processing
10:46:35 PM: Caching artifacts
10:46:35 PM: Started saving node modules
10:46:35 PM: Finished saving node modules
10:46:35 PM: Started saving build plugins
10:46:35 PM: Finished saving build plugins
10:46:35 PM: Started saving pip cache
10:46:35 PM: Post processing - HTML
10:46:35 PM: Post processing - header rules
10:46:35 PM: Finished saving pip cache
10:46:35 PM: Post processing - redirect rules
10:46:35 PM: Started saving emacs cask dependencies
10:46:35 PM: Finished saving emacs cask dependencies
10:46:35 PM: Started saving maven dependencies
10:46:35 PM: Finished saving maven dependencies
10:46:35 PM: Started saving boot dependencies
10:46:35 PM: Post processing done
10:46:35 PM: Finished saving boot dependencies
10:46:35 PM: Started saving rust rustup cache
10:46:35 PM: Finished saving rust rustup cache
10:46:35 PM: Started saving go dependencies
10:46:35 PM: Finished saving go dependencies
10:46:35 PM: Site is live
10:46:38 PM: Build script success
10:46:59 PM: Finished processing build request in 1m42.909271949s