Return 404 if non existant page # PHP

exi

New Member
I have a dynamic review system in place that displays 30 reviews per page, and upon reaching 30 reviews it is paginated. So I have pages such as \[quote\] /reviews/city/Boston/ /reviews/city/Boston/Page/2/ /reviews/city/Boston/Page/3/ and so on and so forth\[/quote\]Unfortunately, Google seems to be indexing pages through what seems like inference - such as \[quote\] /reviews/city/Boston/Page/65/\[/quote\]This page absolutely does not exist, and I would like to inform Google of that. Currently it displays a review page but with no reviews. I can't imagine this being very good for SEO. So, what I am trying to do if first check the # of results from my MySQL query, and if there are no results return a 404 and forward them to the home page or another page.Currently, this is what I have.\[code\]if (!$validRevQuery) { header("HTTP/1.0 404 Not Found"); header("Location: /index.php"); exit;}\[/code\]Am I on the right track?
 
Back
Top