避免多个页面重定向Gatsby http-> https

时间:2020-11-02 07:57:17

标签: redirect pagespeed http-redirect

https://developers.google.com/speed/pagespeed/insights中,由于上述错误,我的速度确实延迟了。 我试图通过将软件包添加到gatsby-config.js来解决该问题,但是它不起作用。在我的site-config.js siteUrl中:https://mysite.co。我该怎么解决?

{
      resolve: 'gatsby-plugin-htaccess',
      options: {
        RewriteBase: '/custom/',
        https: true,
        SymLinksIfOwnerMatch: true,
        host: 'mysite.co',
        redirect: [
          'RewriteRule ^not-existing-url/?$ /existing-url [R=301,L,NE]',
          {
            from: 'http:mysite.co',
            to: 'https:mysite.co',
          },
        ],
      },
    },

enter image description here

1 个答案:

答案 0 :(得分:0)

需要添加 https gatsby-config.js

module.exports = {
  siteMetadata: {
    siteUrl: `https:mysite.co`
  },
相关问题