我有一个_redirects这样的文件:
https://example.netlify.com/* https://example.com/:splat 301!
在根文件夹中。
如何使用gatsby-plugin-netlify从https://example.netlify.com域重定向到https://example.com?
我有一个_redirects这样的文件:
https://example.netlify.com/* https://example.com/:splat 301!
在根文件夹中。
如何使用gatsby-plugin-netlify从https://example.netlify.com域重定向到https://example.com?
您需要将_redirects文件放在static文件夹中,因为 Netlify 会在 build ( /public) 文件夹中查找它,而不是在源代码中。
实际上,如果您只想添加重定向规则,则不需要插件(据我所知)。只需将_redirects文件放在/static文件夹中即可。
你必须编辑 netlify.toml 文件,我在上面写了一篇博文,有更多方法可以做到,取决于你想要什么。
https://www.ionvarsescu.tk/blog/2019-01-19-using-netlify-redirect-301-and-rewrite-200/