Hi!
I want to delete some products from my store. The only problem that I don't want my customers to see the page not found error. How can I deal with this? Maybe any extension supports this functionality?
I'm using M1. Many thanks.
Printable View
Hi!
I want to delete some products from my store. The only problem that I don't want my customers to see the page not found error. How can I deal with this? Maybe any extension supports this functionality?
I'm using M1. Many thanks.
To set up 301/ 302 redirects for your old product pages, you may consider SEO Suite Ultimate extension for Magento:
http://www.mageworx.com/seo-suite-ul...extension.html
The extension will let you create these types of redirects for your old product pages and thus avoid 'page not found' errors.
Also, with the extension you can specify the time period to keep redirects on your site, manage all deleted product redirects and more.
Hi,
Redirects for Product Pages
Observer.php:
class Namespace_Mymodule_Model_Observer {
public function redirect(){
//request object
$request = Mage::app()->getRequest();
//only redirect in the frontend/catalog
$storeId = Mage::app()->getStore()->getId();
if(in_array($request->getModuleName(), array("catalog")) && $storeId != 0) {
$response = Mage::app()->getResponse();
$params = Mage::app()->getRequest()->getParams();
//check the product id
if($params[id] == 10) {
return $response->setRedirect("/mymodule", 301)->sendHeaders();
}
}
}
}
And the config.xml in the global/events section:
<controller_action_predispatch>
<observers>
<namespace_mymodule_observer>
<type>singleton</type>
<class>namespace_mymodule/observer</class>
<method>redirect</method>
</namespace_mymodule_observer>
</observers>