Redirecting Disabled Products.
IMPORTANT: As occasionally with all things of this nature, things can go wrong, typo's, use an incorrect product or category ID etc., it is suggested that before proceeding with this type of modification you test thoroughly with test/sample products & categories prior to modifying live / SEO'ed products.
1) Identify the ID of the product to be disabled, or something unique about its name. In the example this is a Galaxy Note with product ID '1'
2) On the front end of the site, identify the URL of the product to be disabled, and the URL of the product you want to redirect to.
In our example this will be 'phone-case/galaxy-note.html' for the product to be disabled, and 'phone-case/basic-product.html' for the product we wish to redirect to.
3) Once we have target and source successfully identified and the URL's we can now disable the product.
4) Next go to Catalog > URL Rewrite Management, from here you can search for the product using name or id in the respective search field. In the results there should be 2 rules both of these will need to be deleted. One is for the product, the other for category+product.
You may also find additional rules if at some point the URL Key for the product has been changed and a permanent redirect created, these should ideally be left in place where possible, although you may receive errors stating something along the lines of a rule already exists for Path ID when creating your custom rule later.
5) Before deletion we need to copy the 'ID Path' of the product rewrite rule, this is bottom rule of the two shown below, and is 'product/1'.
6) Now we can delete both of these rules, enter each in turn and use the 'Delete' button.
Ordinarily it would be an idea to take note of the field entries of each should we wish to enable the products again at some point in the future. However, we can recreate these rules again using a slightly different method, outlined below.
7) Next, click 'Add URL Rewrite', and use the 'Custom' option from the dialogue.
8) Fill in the fields as per the example below, replacing the URL's & Path ID for the ones associated with your products. Click 'Save', your disabled product should now redirect as expected.
* Note: If the product is available in multiple categories, you will need to recreate a custom rule for each category the disabled product is available, if this is the case you may have also started with more than the two rules provided in our example.
In the example below, this shows the rule redirecting a second category entry for the disabled product, in which the category ID is '5' and the path name for the category being '/personalised-cases/'.
Enable a Previously Disabled & Redirected Product.
1) Delete any rules created in the procedure outlined above from the 'URL Rewrite Management' area.
2) Enable the product, and change the URL Key by adding an hypen or similar, being sure the 'Create Permanent Redirect for old URL' is ticked & save the product. This will create 2 or more Rules, depending on how many categories the disabled product belongs to.
3) Go back to the 'URL Rewrite Management' area and delete the newly created rules. (Search by name / id etc.)
4) Go back to the product and repeat step 2, this time removing the additional hyphen / character you used, and again making sure the 'Create Permanent Redirect for old URL' is ticked. This should leave you with redirect rules that match the originals used when the product was added / modified prior to the disabling and redirecting procedure.
This latter section may seem to be going around the houses a little, however it saves us from having to keep notes / backup screens of any disabled products and trying to restore the system rules deleted. You can if you wish, keep the originals documented and restore this way if preferred.
Redirecting disabled categories is essentially the same procedure as for the products with the following changes:
1) Visit the category view pages rather than product pages to identify the URL's to redirect.
2) In 'Path ID', 'product' is replaced with 'category', e.g. 'category/5'
3) There is usually only a single rule to delete for categories, unless the URL Key have been changed at some point.
4) These redirects exist ONLY for the category view page, wildcards are NOT supported. Therefore cannot be used in place of multiple redirects for products.
5) Category rules WILL redirect URL's containing arguments for 'GET' such as 'phone-case.html?limit=15'
Again please use caution when redirecting categories. Of course with categories there is always the option of just removing these from the menu using the "Include in Navigation Menu" setting to 'No'. This will not result in a 404, however may not always be the desired outcome, but certainly easier to manage.