gpt4 book ai didi

.htaccess - 如何使用静态 html 页面提供 HTTP header 404?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:36:43 24 4
gpt4 key购买 nike

如何返回 HTTP header 404 Not found 并仍然显示静态 html 页面?我有 ErrorDocument 404 mysite.com/searchmysite/index.html 在 .htaccess 中。但显然这对 seo 不利。

类似未回答的问题: Can I change the page's HTML status code on the client side?404 header - HTTP 1.0 or 1.1?

最佳答案

假设您打算将 404 错误代码作为您自己的、不涉及 ErrorDoccument 的自定义 HTML 页面的一部分发送,您可以发送 404 header 使用 Server-Side Code 像 PHP,例如,使用 header("HTTP/1.0 404 Not Found");。您必须在任何输出之前发送它,并在发送之后输出您的自定义网页。

ErrorDocument 也没有理由对 SEO 不利,除非您担心 404 响应,在这种情况下,您不希望首先发送 404 header

关于.htaccess - 如何使用静态 html 页面提供 HTTP header 404?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11070839/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com