4

I have deployed a multi-page gatsby site both to AWS Amplify and Netlify.

When I go to a page that doesn't exist on my site that was deployed with Netlify, I get the 404 page I have created. But when I go to the same non-existent route on the site with Amplify, it redirects me to the root path.

I have checked the network tab, and I get a 404 status code without any HTTP redirects. So I assume the redirect happens in the JavaScript code?

Does this happen to anyone else?

Here is the default Rewrites and Redirects for my site on Amplify:

enter image description here

4

2 回答 2

2

解决方案是将目标地址从更改/index.html/404.html

在此处输入图像描述

于 2020-07-20T13:40:55.983 回答
1

我遇到了同样的问题,但是如果所有页面没有以“/”结尾,它们都会重新加载到主页。删除所有重写规则似乎为我解决了这个问题。我没有使用它们中的任何一个,它们被设置为默认值。比如'www'重路由到'/'。

于 2020-09-13T15:44:00.817 回答