开发者

Why does my website give 404 errors for pages that exist and are accessible?

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 poi开发者_开发百科nting 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?


I had the same problem when I tried to include my wordpress header at the top of the code before the HTML

<?php
    include('blog/wp-blog-header.php');
?>

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


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 as website-design.php and the header include files?

Edit:

Could you try a systematic approach: Start with a blank page, that returns a 200 HTTP code. Add lines of HTML / PHP from one of those pages that returns a 404, line by line, and keep testing after each change until you find what change sent it to a 404 instead of a 200. See if you can trace it down to a specific line of code, a specific function call, include etc., and post the result.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜