简体   繁体   English

对于带有刷新 HTTP 标头的文档,为什么 w3 验证器获取空的源代码?

[英]For document served with Refresh HTTP header, why does w3 validator get empty source code?

I'm trying to check a website via w3 validator , but it always fails with this error:我正在尝试通过w3 validator检查网站,但它总是失败并出现以下错误:

End of file seen without seeing a doctype first.在没有先看到文档类型的情况下看到的文件结尾。 Expected <!DOCTYPE html> .预期<!DOCTYPE html>

It's seems that it fails getting source code of the website for some reason.似乎由于某种原因无法获取网站的源代码。

However, if I add Accept-Language parameter (check this request ), it will validate correctly.但是,如果我添加 Accept-Language 参数(检查此请求),它将正确验证。 It's not only problem with w3 validator, for example, facebook parser, responsible for showing website preview, also doesn't see the source code.这不仅是w3验证器的问题,例如负责显示网站预览的facebook解析器,也看不到源代码。

The website uses Codeigniter php framework.该网站使用 Codeigniter php 框架。 Could it be the problem?这可能是问题吗? Any ideas how to solve the problem?任何想法如何解决问题?

http://teenagewasterecs.com is zero-byte no-content. http://teenagewasterecs.com是零字节的无内容。

So there's nothing there for the validator to check — no document;所以验证器不需要检查任何东西——没有文件; instead the response only has HTTP headers, one of which is a Refresh: 0;url=http://en.teenagewasterecs.com/ header.相反,响应只有 HTTP 标头,其中之一是Refresh: 0;url=http://en.teenagewasterecs.com/标头。

So browsers see that Refresh header, follow it and load http://en.teenagewasterecs.com/ .所以浏览器会看到Refresh标头,跟随它并加载http://en.teenagewasterecs.com/

But the validator doesn't follow that Refresh , nor load that other URL.但是验证器不遵循Refresh ,也不加载其他 URL。 Instead the validator tries to load and check http://teenagewasterecs.com .相反,验证器会尝试加载并检查http://teenagewasterecs.com But it's empty;但它是空的; thus the validator error you see.因此你看到的验证器错误。

You are getting this error because the website link which you are checking您收到此错误是因为您正在检查的网站链接

http://en.teenagewasterecs.com/

shows a 404 page not found on this link.显示在此链接上找不到的 404 页面。 Try with other website links.尝试使用其他网站链接。

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM