Automatic redirects

Your store can be configured to automatically generate a permanent redirect whenever the URL key of a product or category changes. In the Search Engine Optimization section, the checkbox below the URL key indicates if permanent redirects are enabled. If your store is already configured to automatically redirect catalog URLs, a redirect is a simple update to the URL key. The process to create an automatic redirect is the same for both products and categories.

NOTE
When automatic redirects are enabled and you save a category, all product and category rewrites are generated in real time and stored in database tables by default. This could result in significant performance issues for categories with many assigned products. The solution is to change this default and skip the generation of category/products URL rewrites for products on category save. In this case, product rewrites are generated only for the canonical product URL.

Set up automatic redirects

  1. On the Admin sidebar, go to Stores > Settings > Configuration.

  2. In left panel, expand Catalog and choose Catalog underneath.

  3. Expand Expansion selector the Search Engine Optimization section.

    Catalog configuration - search engine optimization {width="600" modal="regular"}

  4. Set Create Permanent Redirect for URLs if URL Key Changed to Yes.

  5. When complete, click Save Config.

Automatically redirect product URLs

  1. On the Admin sidebar, go to Catalog > Products.

  2. Find the product in the list and click to open the record.

  3. Expand Expansion selector the Search Engine Optimization section.

    Product search engine optimization - permanent redirect {width="600" modal="regular"}

  4. For URL Key, do the following:

    • Make sure that the Create Permanent Redirect for old URL checkbox is selected. If not, follow the instructions to enable automatic redirects.

    • Update the URL Key as needed, using all lowercase characters and non-trailing hyphens between these characters instead of spaces.

  5. When complete, click Save.

  6. When prompted to refresh the cache, follow the links in the message at the top of the workspace.

    The permanent redirect is now in effect for the product and any associated category URLs.

Automatically redirect category URLs

  1. On the Admin sidebar, go to Catalog > Categories.

  2. Find the category in the tree and click to open the record.

  3. Expand Expansion selector the Search Engine Optimization section.

  4. For URL Key, do the following:

    • Make sure that the Create Permanent Redirect for old URL checkbox is selected. If not, follow the instructions to enable automatic redirects.

    • Update the URL Key as needed, using all lowercase characters and non-trailing hyphens between these characters instead of spaces.

  5. When complete, click Save.

  6. When prompted to refresh the cache, follow the links in the message at the top of the workspace.

    The permanent redirect is now in effect for the category and any associated product URLs.

Skip generation of product URL rewrites for category save skip-rewrite

WARNING
Turning off automatic generation of category/products URL rewrites results in permanent removal of all existing category/product type URL rewrites, which cannot be restored. This could potentially cause unresolved category/product type URL conflicts that require a manual update of the URL key to resolve.
  1. On the Admin sidebar, go to Stores > Settings > Configuration.

  2. In left panel, expand Catalog and choose Catalog underneath.

  3. Expand Expansion selector the Search Engine Optimization section.

  4. Set Generate “category/product” URL Rewrites to No.

  5. In the confirmation dialog, click OK to confirm the change and the removal of existing URL rewrites.

    Turn off category/product URL rewrites - confirm {width="350"}

  6. When complete, click Save Config.

recommendation-more-help
d5ef48ad-708f-4ce5-a225-e7bb6053ded5