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.
Looking at magento's core code i can see it handles 404's like so in the core indexController:
/**
* Default index action (with 404 Not Found headers)
* Used if default page don't configure or available
*
*/
public function defaultIndexAction()
{
$this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
$this->getResponse()->setHeader('Status','404 File not found');
$this->loadLayout();
$this->renderLayout();
}
/**
* Render CMS 404 Not found page
*
* @param string $coreRoute
*/
public function noRouteAction($coreRoute = null)
{
$this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
$this->getResponse()->setHeader('Status','404 File not found');
$pageId = Mage::getStoreConfig(Mage_Cms_Helper_Page::XML_PATH_NO_ROUTE_PAGE);
if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
$this->_forward('defaultNoRoute');
}
}
/**
* Default no route page action
* Used if no route page don't configure or available
*
*/
public function defaultNoRouteAction()
{
$this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
$this->getResponse()->setHeader('Status','404 File not found');
$this->loadLayout();
$this->renderLayout();
}
Is there any way I can add a function to a deleted page to send a 410 header?