Silent PHP bug served empty pages as 200 OK, triggering Google indexing issues
A PHP web application was silently serving deleted or inactive content pages with HTTP 200 responses instead of the expected 302 redirects, due to a flawed metadata guard condition. The bug stemmed from array_merge returning a non-empty array even when no real metadata existed, causing the redirect check to never fire. As a result, Google Search Console flagged hundreds of URLs over several weeks for issues including duplicate canonicals and unindexed crawled pages, with no errors appearing in application logs. The root fix was changing the guard from checking whether the metadata array existed to checking whether a specific required field, the page title, was present. The corrected condition ensured inactive or deleted URLs properly redirected users and search engine crawlers to the relevant section listing page.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in