Skip to content

URL Rewrites vs multiple storeviews - too many rewrites are being generated #11616

Closed
@hostep

Description

@hostep

This case demonstrates that too many url rewrites are being generated
It happens in Magento 2.4-develop, I tested it in 2.2 and over there it works as expected

Preconditions

  1. PHP 7.2
  2. Magento 2.4-develop

Steps to reproduce

  1. Setup a Magento 2.4-develop installation
  2. In the backend, go to Stores > Configuration > Catalog > Catalog > Search Engine Optimization and change the configuration 'Use Categories Path for Product URLs' to 'Yes'
  3. In the backend, go to Stores > All Stores and make sure you have 2 storeviews, I'm using 'Dutch' and 'French' as examples here
  4. In the backend, go to Catalog > Categories and create 2 subcategories with the following url keys in the default values and 2 storeview specific (don't check the 'Create Permanent Redirect for old URL' checkbox while doing so):
Tree Name Default Dutch French
Default Category/Level 1 Level 1 level-1 level-1-nl level-1-fr
Default Category/Level 1/Level 2 Level 2 level-2 level-2-nl level-2-fr
  1. In the backend, go to Catalog > Products and create a new simple product. I named it 'Product 2'. Assign it to both categories 'Level 1' and 'Level 2'
  2. Check the url_rewrite table in the database

Expected result

request_path target_path store_id
level-1-nl.html catalog/category/view/id/3 1
level-1-nl/level-2-nl.html catalog/category/view/id/4 1
level-1-fr.html catalog/category/view/id/3 2
level-1-fr/level-2-fr.html catalog/category/view/id/4 2
product-2.html catalog/product/view/id/2 1
level-1-nl/product-2.html catalog/product/view/id/2/category/3 1
level-1-nl/level-2-nl/product-2.html catalog/product/view/id/2/category/4 1
product-2.html catalog/product/view/id/2 2
level-1-fr/product-2.html catalog/product/view/id/2/category/3 2
level-1-fr/level-2-fr/product-2.html catalog/product/view/id/2/category/4 2

Actual result

Magento 2.4-develop

request_path target_path store_id
level-1-nl.html catalog/category/view/id/3 1
level-1-nl/level-2-nl.html catalog/category/view/id/4 1
level-1-fr.html catalog/category/view/id/3 2
level-1-fr/level-2-fr.html catalog/category/view/id/4 2
product-2.html catalog/product/view/id/2 1
level-1-nl/product-2.html catalog/product/view/id/2/category/3 1
level-1-nl/level-2-nl/product-2.html catalog/product/view/id/2/category/4 1
level-1/product-2.html catalog/product/view/id/2/category/3 1
product-2.html catalog/product/view/id/2 2
level-1-fr/product-2.html catalog/product/view/id/2/category/3 2
level-1-fr/level-2-fr/product-2.html catalog/product/view/id/2/category/4 2
level-1/product-2.html catalog/product/view/id/2/category/3 2

The two rows in bold shouldn't be generated.

Metadata

Metadata

Assignees

Labels

Component: CatalogUrlRewriteFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions