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