Hi David,
Just wondering if you have an ideas as to how to avoid the following......
If I have a category, or list of new products etc. that amounts to, say, 200, and I'm showing 20 per page, I'll end up with 20 pages of products. This is handled correctly by the navigation system. However, there's nothing to catch any stuffing of the header so someone could enter www.site.com/category/stuff/rubbish.html (where rubbish would replace the page number 1, 2 etc.) and this would still result in a valid page, albeit with no search results. I guess using .htaccess this could be limited to checking for numerics but if a random number was entered greater than 20, in this case, a valid page would again be displayed with no search results.
Ultimately, this could result in a load of useless duplicate content if someone were to be nasty and submit a spammed up site map. The best way to deal with this case, I think, would be to return a 404. So, any ideas on how to accomplish this please?
Cheers.
Keeop
Hi Keeop,
Sure! Page 1 (or rather zero) of a single query should probably continue to return the normal "no results" page, but what is straight forward to do would be to calculate total pages, and if $page is set and is greater than that value then return 404. In search.php look for the following around line 260:
$header["title"] = htmlentities($q,ENT_QUOTES,$config_charset);
...and REPLACE with:
if (isset($_GET["page"]))
{
$lastPage = ceil($resultCount/$configResultsPerPage);
if (($page > $lastPage) || (!$resultCount && ($page > 1)))
{
header("HTTP/1.0 404 Not Found");
exit();
}
}
$header["title"] = htmlentities($q,ENT_QUOTES,$config_charset);
Hope this helps!
Cheers,
David.
--
PriceTapestry.com