Magento - 410已删除产品的状态标题

时间:2015-08-28 14:03:06

标签: magento http-status-code-410

我的magento商店会遇到大量的产品,这些产品会被添加然后删除。我被要求在这些已删除的页面上实现410状态代码,但我不确定如何。

看看Magento的核心代码,我可以看到它在核心indexController中处理404就像这样:

/**
 * 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();
}

有没有办法可以为删除的页面添加一个函数来发送410标题?

0 个答案:

没有答案