I deployed my React website build/ folder into an AWS S3 bucket.
If I go to www.mywebsite.com, it works and if I click on a ta
I'm using NextJS and had the same issue. My solution was to check the routing information and push if it doesn't fit.
const router = useRouter();
useEffect(() => {
if (!router.pathname.startsWith(router.asPath)) {
router.push(router.asPath);
}
});
Nothing needed to be modified at the S3 side except from routing the error page to index.html