How to redirect to the specific page if the route was not found?
Hey folks👋 I'm using static HTML files and deploying them from a Git repo. If a user opens non-existent pages, I want to redirect them to 404.html. How can I do this? I haven't found any mention of this in the documentation.
1 Reply
404.html should do the trick here
"You can define a custom page to be displayed when Pages cannot find a requested file by creating a 404.html file. Pages will then attempt to find the closest 404 page. If one is not found in the same directory as the route you are currently requesting, it will continue to look up the directory tree for a matching 404.html file, ending in /404.html. This means that you can define custom 404 paths for situations like /blog/404.html and /404.html, and Pages will automatically render the correct one depending on the situation."
https://developers.cloudflare.com/pages/configuration/serving-pages/