【发布时间】:2021-02-14 21:11:38
【问题描述】:
在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',
},
],
},
},
【问题讨论】:
-
重定向在服务器上配置。如果您使用 apache,那么您可能在其中编写了
.htaccess文件。如果你使用 nginx 那么可能在/etc/nginx/sites-available/default
标签: redirect pagespeed http-redirect