Skip to content
Demonstrates and fix Netlify routing issue
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
components
pages
static
.gitignore
404.html
README.md
netlify.toml
next.config.js
package.json
yarn.lock

README.md

Detailed Blog https://blog.kiprosh.com/show-custom-404-error-page-for-netlify-applications/

Preview Available on Netlify

This Repo demonstrates issue with Netlify routing and a simple hack to fix it.

for redirects

[[redirects]]
  from = "/*"
  to = "/error"
  status = 404

Netlify should redirect user to /error for any route which is not found but for routes starting with /error (starting with to path) i.e

/error__
/error*

Netlify still shows its default 404 error page. We can fix this issue by creating 404.html and adding following code to redirect user to error page

    window.location.href = window.location.origin + "/error";
You can’t perform that action at this time.