Redirect 避免多页重定向Gatsby http->;https

Redirect 避免多页重定向Gatsby http->;https,redirect,pagespeed,http-redirect,Redirect,Pagespeed,Http Redirect,在我看来,由于上面的错误,我的速度确实被延迟了。 我试图通过将包添加到gatsby-config.js中来解决这个问题,但它不起作用。在my site-config.js siteUrl:https://mysite.co。我怎样才能解决它 { resolve: 'gatsby-plugin-htaccess', options: { RewriteBase: '/custom/', https: true, SymLink

在我看来,由于上面的错误,我的速度确实被延迟了。 我试图通过将包添加到gatsby-config.js中来解决这个问题,但它不起作用。在my 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',
          },
        ],
      },
    },

需要添加
https
gatsby-config.js

module.exports = {
  siteMetadata: {
    siteUrl: `https:mysite.co`
  },

重定向是在服务器上配置的。如果您使用apache,那么您可能在编写它的地方有
.htaccess
文件。如果您使用nginx,那么可能在
/etc/nginx/sites available/default