My Magento store experiences a high amount of products that get added and then deleted. I have been asked to implement a 410 status code on these deleted pages but I am unsure how.

I have installed a extension


But its only listing the URLs which going to 404 pages.

How can I set all 404 pages to 410 status.

Can I get some help? Thank you in advance.

  • You just want to set them in 410 status and not redirect them anywere? Sep 6, 2021 at 11:26
  • @Alan Zavagli Thank you for response. yes Sep 6, 2021 at 12:32

1 Answer 1


I have found the solution for this.

I have user this plugin to catch the 404 urls

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    <type name="Magento\Cms\Controller\Noroute\Index">
        <plugin name="trackNoRoutePages"

Here am redirecting them to 410 gone page which I created in Page from content>>pages. and setting headers to 410


namespace Experius\Pvn\Controller\Plugin;

class TrackNoRoutePages
    public function afterExecute(
        \Magento\Cms\Controller\Noroute\Index $subject,
    ) {

        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $redirect = $objectManager->get('\Magento\Framework\App\Response\Http');

        $storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');

        $redirect->setStatusHeader(410, '1.1', 'Gone');
        $redirect->setHeader('Status', '410 Gone');

        return $redirect;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.