Imagine a pagination script with 20 total pages:
articles.php?page=18
What should I do when some third party web site links to a non-existent page?
articles.php?page=21 (page 21 is out of bounds)
articles.php?page=-10 (as is this)
articles.php?page=blabla (or this)
problem is... (I have 20 total pages)
- some 3rd party site links
articles.php?page=21
that doesn't exist (last page is the 20th) - and I send 404/301 as a response
- Google crawls that link
- some time after, the total number of articles increases and will make the 21st page appear
- the 404/301 will be removed in favor of the status 200
Is that correct? Is 404 or 301 better? Do I need some more expedients?
(with a 301 redirect I mean redirecting to the closest valid page)
more answers are welcome!!