Skip to content

URL Rewrites vs multiple storeviews - a never ending battle #11615

Closed
@hostep

Description

@hostep

I'm pretty sure this has been reported before, but please excuse me if I didn't find the correct duplicate, since there are so many issues being reported around this. If there is an exact duplicate, please mark this issue as a duplicate and close it.
My hope is to provide a easy reproducible case which can easily be tested and maybe finally put this big issue a bit more in the spotlight.

Preconditions

  1. PHP 7.0.24
  2. Both Magento 2.1.9 and 2.2.0 (the situation in 2.2.0 is slightly better then 2.1.9, but there are still problems)

Steps to reproduce

  1. Setup a Magento 2.1.9 and 2.2.0 installation separately and execute all the steps mentioned below on both of them
  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. At this point, the url rewrites in the database table are correct, so no issues here
  2. In the backend, go to Catalog > Products and create a new simple product. I named it 'Product 1'. Assign it to the category 'Level 2', not on any category above it.
  3. Check the url_rewrite table in the database, it is different in Magento 2.1.9 and 2.2.0, in 2.2.0 it is slightly better then in 2.1.9, but still not bug free

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-1.html catalog/product/view/id/1 1
level-1-nl/level-2-nl/product-1.html catalog/product/view/id/1/category/4 1
level-1-nl/product-1.html catalog/product/view/id/1/category/3 1
product-1.html catalog/product/view/id/1 2
level-1-fr/level-2-fr/product-1.html catalog/product/view/id/1/category/4 2
level-1-fr/product-1.html catalog/product/view/id/1/category/3 2

Actual result

Magento 2.1.9

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-1.html catalog/product/view/id/1 1
level-1/level-2/product-1.html catalog/product/view/id/1/category/4 1
level-1/product-1.html catalog/product/view/id/1/category/3 1
product-1.html catalog/product/view/id/1 2
level-1/level-2/product-1.html catalog/product/view/id/1/category/4 2
level-1/product-1.html catalog/product/view/id/1/category/3 2

Magento 2.2.0

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-1.html catalog/product/view/id/1 1
level-1-nl/level-2-nl/product-1.html catalog/product/view/id/1/category/4 1
level-1/product-1.html catalog/product/view/id/1/category/3 1
product-1.html catalog/product/view/id/1 2
level-1-fr/level-2-fr/product-1.html catalog/product/view/id/1/category/4 2
level-1/product-1.html catalog/product/view/id/1/category/3 2

Metadata

Metadata

Assignees

Labels

Component: CatalogUrlRewriteEvent: distributed-cdDistributed Contribution DayFixed 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.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions