0

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.

Henrik Erlandsson
  • 3,797
  • 5
  • 43
  • 63
  • http://coppershade.org/articles/Code/Tools/AsmTwo returns 404. Try from scratch and add stuff one thing at a time to find the point when it breaks. – zerkms Sep 10 '17 at 02:44
  • _“old PHP version, 5.2.17”_ - that is the first thing you should get fixed; this version has been out of support for several years now already. Still running any website on that is rather irresponsible. http://php.net/supported-versions.php – CBroe Sep 11 '17 at 07:22
  • @CBroe: Thanks for commenting. But how do I go from you agreeing with me that the host's PHP version is old to the cause of the problem? It's not like scrapers see anything but the output from whatever version. – Henrik Erlandsson Nov 01 '17 at 19:35
  • Well you'd have to show us how you implemented those URLs in the first place ... likely not a problem of PHP version. _"and the same URL [...]"_ - well they aren't, they are two different URLs. Whether they should be _treated as_ the same and by whom/how, is up to you - implement a 301 redirect to the preferred version, set canonical/og:url, ... – CBroe Nov 01 '17 at 20:06
  • `` - that's wrong in any case of course, because by that you are telling Facebook that was the URL to fetch the OG meta data from. – CBroe Nov 01 '17 at 20:09

0 Answers0