The netlify.toml
file is how Netlify handles file-based configuration, which lets you configure more advanced options for your deploys, as well as override options which you can otherwise set in the web-based frontend. If your repository doesn’t already have this file, you can create it at the root of your repository and Netlify will read it automatically on the next deploy.
While you can’t set up redirect rules from the frontend, you don’t necessarily need to create a netlify.toml
file to use a custom 404 error page, though doing so gives you more advanced control. You can also create a _redirects
file in the publish directory (ie: the directory that actually gets published by Netlify) with the original destination (including a splat *
that matches anything after it, if desired), the redirected destination and an HTTP status code.
# Put this in _redirects in your publish directory
# This shows a custom 404 page for any paths on the site
/* /404.html 404