Why does setting headers to 200 OK give 404 Not Found with scraping tools?

71 views Asked by At

This is on an old PHP version, 5.2.17 that one of my web hosts has. The following code is verified to be executed on page load, before headers are sent:

header($_SERVER["SERVER_PROTOCOL"]." 200 OK");

However, using the Facebook Debugger and double-checking with this alternative gives a 404 error. Despite this, the page content is fetched and indexed OK by the scraper. Needless to say, I would like to not get a 404 reported to scrapers if the page loads correctly in all browsers, validates, and has correct headers.

One example is this link, which returns a 200, and

the same URL (without trailing /), which returns a 404.

How do I accomodate SEF URLs with or without trailing slashes to be scraped correctly? Although I doubt this is the problem, since Wikipedia links have no trailing slashes and report 200 OK.

0

There are 0 answers