如何使盖茨比的自定义404页返回404状态代码

发布于 2025-02-05 04:59:32 字数 204 浏览 1 评论 0原文

我有一个自定义的404页,它的工作正常。当用户存在不存在的URL时,可以说example.com/abcd,将它们重定向到404自定义页面。但是404自定义页面具有200个状态代码,这对SEO不利。当我阅读一些信息时,这是正常的行为,因为404页存在。

但是,有没有机会让此页面返回404状态代码?

Gatsby版本为2.17.11。

I have a custom 404 page and its working fine. When the user has a non existed url, lets say example.com/abcd, they are redirected to the 404 custom page. But the 404 custom page has 200 status code, that is not good for SEO. And as I read some information, this is normal behaviour because the 404 page exists.

But is there any chance to make this page to return 404 status code?

Gatsby version is 2.17.11.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文