Urgent.News

What's breaking now, across thousands of outlets.

Tech

Page 999 of my 5-page blog returned 200 and said it was canonical

Search Console, this morning: Discovered - currently not indexed 20,852 Crawled - currently not indexed 1,582 Excluded by 'noindex' tag 63 My sitemap has 6,240 URLs. Google knows about roughly 22,500 addresses on a site that publishes 6,240. Nobody typed the other sixteen thousand. Something on the site is generating them. The pager public static function paged ( int $page = 1 , int $perPage = 9…

The blog owner discovered that some URLs on their site were being indexed by Google even though they didn't exist. The server responded with HTTP 200 status code for invalid page numbers like page 6 and page 999, instead of returning HTTP 404. This led to these invalid URLs being treated as canonical versions by Google, even though they were never meant to exist.

The root cause was that the pager function returned the correct page number (5) when asked for an invalid page (999), but the template used the request parameters instead of the response to generate the canonical URL. To fix this issue, the blogger implemented additional checks to ensure that only valid page numbers were served, and canonical URLs reflected the actual page that was rendered.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Tuesday 8 September →