Why is my site giving 404 errors for pages that exist and are accessible?

My problem is that on some pages of my website, for example http://www.piranha-internet.co.uk/web/website-design.php I was sent a 404 error message in Google Webmaster Tools . However, I can normally access the pages, all of them have links pointing to them internally, but not from external ones.

  • I checked the header checks on this page and also got the number 404.
  • I created empty files on my server and it seems to me that they give me 200 code, but if I duplicate and rename the 404 files in question, I get the same 404 errors.
  • I have about 40 pages on my site, half of which give 200 code and half 404. They all use the same structure, and the same includes, but the content is different for all of them.

Why is this happening?

+4
source share
3 answers

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

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

Pages worked, but Google saw 404 and did not index pages.

Solved the problem by moving PHP inside the body of HTML.

Strange problem ...

Dan

+3
source

Appears when I am http://www.piranha-internet.co.uk/web/website-design.php using Fiddler, I get an HTTP 404 status code returned along with the contents of the page. Somewhere your server, or your code is actually sending a 404 HTTP status code.

Is it possible to show some of your .php sources for the relevant pages, for example website-design.php , and the header includes files?

Edit:

Could you try a systematic approach: Start with a blank page that will return 200 HTTP code. Add HTML / PHP lines from one of those pages that returns 404 lines by line and saves testing after each change, until you find which changes are sent to 404 instead of 200. See if you can trace it to a specific line of code, a special call functions, enable, etc. and publish the result.

+2
source

What you see in GWT is the actual HTTP response code. 404 in your case, a means "Not Found."

By definition, this marks the request as β€œNot Found” and what the GWT tells you.

In any PHP script, you can set the response code in addition to the exit. I do not understand the code /web/website-design.php , so it’s hard to say what is wrong or if it is not at all.

You can search for the use of the header () function in your code. This function can set a response code.

0
source

All Articles