score:0

You need to map all paths to the index.html file. Because your project is SPA.

score:0

I have solved the problem this way.

First I have set AWS S3 redirection rules as such

[
    {
        "Condition": {
            "HttpErrorCodeReturnedEquals": "404"
        },
        "Redirect": {
            "ReplaceKeyWith": ""
        }
    }
]

In this way, any time a 404 error is raised, the redirect policy brings to the Index document (i.e. the empty key).

Moreover, to make sure that even if this configuration is not set, I have forced to navigate to the Home component using an effect hook in the top level component, something like this

const history = useHistory();
useEffect(() => {
    history.push("/");
}, [history]);

Related Query

More Query from same tag