Hi,
I checked how the redirect plugin works and as far as I can see, it catches 404 errors so that it can redirect to the new URL.
And it has been like that for a while if not always.
Now, at the beginning of the "product/show.php" file of HikaShop you have this code:
if(empty($this->element)) {
if($this->config->get('404_when_product_not_found',1)){
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found", true, 404);
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('PRODUCT_NOT_FOUND'), 'error');
echo '</div>';
return;
}
$app->enqueueMessage(JText::_('PRODUCT_NOT_FOUND'));
hikashop_setPageTitle(JText::_('PRODUCT_NOT_FOUND'));
echo '</div>';
return;
}
So what this code does is that when it can't load the product for the product page (because the alias changed, like in your example), it will send a 404 error and display the "product not found" error.
I see that this is still the case on your link:
monosnap.com/file/wX8lN8lUW9iBius1l41hAK3HA8r7qT
However, with HikaShop 4, we've changed that code.
Before that code was:
if(empty($this->element)) {
if($this->config->get('404_when_product_not_found',1)){
//header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
JError::raiseError(404, JText::_('PRODUCT_NOT_FOUND'));
echo '</div>';
return;
}
$app->enqueueMessage(JText::_('PRODUCT_NOT_FOUND'));
hikashop_setPageTitle(JText::_('PRODUCT_NOT_FOUND'));
echo '</div>';
return;
}
As you can see, it was using JError::raiseError while now we directly use the header() function of PHP.
We did that change because with Joomla 4, we can't use JError::raiseError anymore as this has been completely removed.
I think that's why the redirect doesn't work anymore.
So try to change the code:
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found", true, 404);
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('PRODUCT_NOT_FOUND'), 'error');
to:
throw new Exception(JText::_('PRODUCT_NOT_FOUND'), 404);
That should make it work like it did before.
Let us know how it goes so that we can include the patch for the next version of HikaShop.