Question

I redirecting 404 not found page to product page using controller_action_predispatch_cms_noroute_index event observer.

Observer:

$request = $observer->getData('request');
$request->initForward();
$params = ['id' => $productId, 'category' => $categoryId];
$request->setParams($params)
    ->setModuleName('catalog')
    ->setControllerName('product')
    ->setActionName('view')
    ->setDispatched(false);

Product page loading perfectly but 404 not found page also loaded with it.

Does anyone have an idea?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top