Then, simply change it to 302.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Would not be an issue. Any changes in the number of results will take you back to the first page anyway. No internal links should take you to a second page with no results. That just leaves external links. It's the actual results that will be important.by mona wrote: ↑Fri Sep 03, 2021 6:03 pmYou can do that but remember, a 404/410 should be given when a page does not exist, not when no products are found, website-logic vs. business-logic.Code: Select all
if (!$results && (int)$page != 1) { $this->response->redirect($this->url->link('error/not_found')); }
When a request is made for page=10 but page 10 does not exist (given the number of products and the limit), you could give a 404 and when you do not let page= be indexed requests for them should not happen unless manually entered.Code: Select all
// non-existent pages (requested page > number of pages) if (!empty($this->request->get['page'])) { if (ceil($product_total / $limit) < $this->request->get['page']) { header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true); exit(); } }
However, when a page does not yield products, you simply state that no products are found, you do not give a 404, the page exists, the products don't.
You could have combinations of filters, price ranges, search keywords, etc. which simply yield no products.
In short, the $results are irrelevant for a 404 response.
The problem with 404/410 is it's not very customer friendly. A potential customer click a link in a search engine that takes them to /something?page=2, which now no longer exists due to lees products in that category. With a 404/410 they will not see much and will probably leave. With a redirect to the fist page they might find a product they are looking for.
A 404/410 may get the page removed more quickly, but it could still take months.
Who is online
Users browsing this forum: No registered users and 28 guests