【问题标题】:Redirect from Netlify to Custom Domain using gatsby-plugin-netlify?使用 gatsby-plugin-netlify 从 Netlify 重定向到自定义域?
【发布时间】:2018-07-28 08:17:04
【问题描述】:

我有一个像这样的_redirects 文件:

https://example.netlify.com/* https://example.com/:splat 301!

在根文件夹中。

如何使用gatsby-plugin-netlifyhttps://example.netlify.com 域重定向到https://example.com

【问题讨论】:

    标签: javascript reactjs gatsby netlify


    【解决方案1】:

    实际上,如果您只想添加重定向规则,则不需要插件(据我所知)。只需将_redirects 文件放在/static 文件夹中即可。

    【讨论】:

      【解决方案2】:

      您需要将 _redirects 文件放在 static 文件夹中,因为 Netlify 会在 build (/public) 文件夹中查找它,而不是在源文件夹中。

      【讨论】:

      • 谢谢我做到了。起初我确实将它复制到public/ 文件夹,但它没有用。现在它可以工作了:)
      【解决方案3】:

      您必须编辑 netlify.toml 文件 我已经写了一篇关于它的博文,还有更多方法可以做到,取决于你想要什么。

      https://www.ionvarsescu.tk/blog/2019-01-19-using-netlify-redirect-301-and-rewrite-200/

      【讨论】:

        猜你喜欢
        • 2021-10-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-05-27
        • 2021-08-20
        • 1970-01-01
        相关资源
        最近更新 更多