为什么我的网站对存在且可访问的页面给出 404 错误?
我的问题是在我网站上的某些页面上,例如 http://www .piranha-internet.co.uk/web/website-design.php 我在 Google 网站管理员工具中收到 404 错误。但是我可以正常访问这些页面,它们都有指向内部的链接,但还没有来自外部的链接。
- 我已经在此页面上进行了标头检查,并且也收到了 404 错误。
- 我在我的服务器上创建了空白文件,它们看起来很好,给了我 200 代码,但如果我复制并重命名有问题的 404 文件,我会得到相同的 404 错误。
- 我的网站上大约有 40 个页面,其中一半给出 200 代码,一半给出 404。它们都使用相同的结构和内容。包括相同的内容,但所有内容都不同。
为什么会发生这种情况?
My problem is that on certain pages on my website such as http://www.piranha-internet.co.uk/web/website-design.php I am been served with a 404 error in Google Webmaster Tools. However I can access the pages normally, they all have links pointing to them internally, non yet from external.
- I have done header checks on this page and get served a 404 as well.
- I have created blank files on my server and they seem fine giving me a 200 code but if I duplicate and rename the 404 files in question I get the same 404 errors.
- I have roughly 40 pages on my site, half of which give 200 code and half 404. They all use the same structure & same includes but the content is different on all of them.
Why is this happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当我尝试在 HTML 页面之前将我的 WordPress 标头包含在代码顶部时,我遇到了同样的问题,
但 Google 看到了 404 并且不会索引页面。
通过将 PHP include 移到 HTML 正文中解决了该问题。
奇怪的问题...
丹
I had the same problem when I tried to include my wordpress header at the top of the code before the HTML
The pages worked but Google saw a 404 and wouldn't index the pages.
Solved the problem by moving the PHP include inside the body of the HTML.
Weird problem...
Dan
当我访问 http://www.piranha-internet.co 时,它会出现。使用 Fiddler 访问 uk/web/website-design.php 时,我得到了随页面内容一起返回的 404 HTTP 状态代码。您的服务器或您的代码实际上正在发送 404 HTTP 状态代码。
您是否可以显示相关页面的一些
.php
源代码,例如website-design.php
和标头包含文件?编辑:
It appears when I visit http://www.piranha-internet.co.uk/web/website-design.php using Fiddler, I get a 404 HTTP status code returned along with the page content. Somewhere your server, or your code is actually sending a 404 HTTP status code.
Is there a possibility you could show some of your
.php
source code for the relevant pages, such aswebsite-design.php
and the header include files?Edit:
您在 GWT 中看到的是实际的 HTTP 响应代码。 404 在你的情况下意味着“未找到”。
根据定义,这会将请求标记为“未找到”,这就是 GWT 向您报告的内容。
在任何 PHP 脚本中,除了输出之外,您还可以设置响应代码。我对
/web/website-design.php
的代码没有深入的了解,所以很难判断出了什么问题或者是否有问题。您可以在代码中查找 header() 函数 的使用。该函数可以设置响应代码。
What you see in GWT is the actual HTTP response code. 404 in your case an it means "Not Found".
By definition this marks the request as "Not found" and that's what GWT reports to you.
Within any PHP script you can set the response code in addition to the output. I have no insight into the code of
/web/website-design.php
so it's hard to tell what's wrong or if it's wrong at all.You could look for the use of the header() function within your code. That function can set the response code.