If a product has assigned in multiple categories.on product listing page, product URL remains the same for each category.
e.g- Suppose a product "A" has assigned in category "B","C" & D where B,C,D already have parent category "view-all-category".
then whenever I visited the product "A" from all of these categories(B,C,D) each time I'm getting a unique product URL.
Example:-
When visiting "A" from category "B" =>
This is right-> http://localhost/view-all-category/B/A.html
When visiting "A" from category "C" =>
Currently getting-> http://localhost/view-all-category/B/A.html
Expected URL:- http://localhost/view-all-category/C/A.html
When visiting "A" from category "D" =>
Currently getting-> http://localhost/view-all-category/B/A.html
Expected URL:- http://localhost/view-all-category/D/A.html
Note:- I've migrated from Magento 1 to Magento 2 using Magento Data Migration Tool & also using a custom theme.
Waiting forward the response.