I have migrated from Magento 1 to Magento 2 and when updating/changing the URL key of a migrated products "Test" from "test" to "test2" still getting old URL of this product on the frontend "mydomainname/test.html" while it should be "mydomainname/test2.html".
but When I deleted old URL key and added new URL key from "URL Rewrite" module then I'm able to access product directly by new URL(mydomainname/test2.html).
Suppose this product "Test" is assigned in the category "XYZ". when I visited on XYZ category page to visit on "Test" product then instead of getting "Domainname/XYZ/test2.html" URL getting a strange URL for the "Test" product only. while other migrated products URL in this category is very user-friendly ("Domainname/XYZ/urlkey.html").
Note:- I've already gone through the R&D and didn't get any useful solution. Already performed reindexing, cache clean etc.