prestashop returning 302 instead of 404 for unexistent pages

after couple of hours trying to find a solution, because of the SEO implications which seemed pretty important, i was able to track down the error to ProductController.php, lines 106

    if (!Validate::isLoadedObject($this->product)) {
//           Tools::redirect('index.php?controller=404');
             header('HTTP/1.1 404 Not Found');
             $this->errors[] = $this->trans('This product is no longer available.', [], 'Shop.Notifications.Error');
             $this->setTemplate('errors/404');
             return;

the way this was coded if the product was not validted it redirected to the 404. which as a practical way may work, but the search engines see a 302 (temporary redirect) instead of a 404 (not found).

Leave a Reply

Your email address will not be published. Required fields are marked *