This is a question on the best action to take when Google is indexing pages that don't really exist.
I have a pretty simple pagination system on a set of news pages where the file is referenced news.php?page=X
.
In my Google sitemap I specify the total number of valid pages of this type (currently up to news.php?page=13
).
The on-screen pagination is a standard "1,2,3... Next/Previous" layout.
However, Google Search Console reveals that it is monitoring 14,846 pages in this format. For example, news.php?page=7556
and others like it are turning up in search results.
The way the pagination works, news.php?page=7556
will show the same content as news.php?page=13
. In other words, the oldest few news items. Needless to say, there are no links anywhere to any news pages other than 1-13.
I don't know for sure if this is having a negative impact on search but I wouldn't want legitimate content to suffer.
So, my question is, what's the best way to stop Google indexing thousands of non-pages? Should I just create a 404 or 301 redirect for any page that doesn't contain legitimate content? If a 301 redirect, what should it redirect to?
UPDATED Monday Nov 13th:
As advised by Ilmari Karonen I have added rel=canonical to the page headers so that a request for news.php?page=7556 shows that the canonical URL is news.php?page=13. I have not added 301 redirects or redirects to 404 error pages for now. I'll monitor the results on Search Console and report back on anything useful.