If we check the url rewrite table in the database then all the url's are deleted with product id 7775
If we save the product nothing change and can not found the urls anymore in de url rewrite table.
If we save a product (from magento 2.1.2) and don't change the url then the rewrite-url is ok.
We use multistore with url store code.
Unfortunately, I could not reproduce the issue as you described it on 2.1.3 version. Please provide the detailed steps we must follow to reproduce this issue.
Need more information about:
@naydav



I still could not reproduce the issue.
Db state after steps:

Pay attention:
request_path - it is URL path to reach product on frontend
target_path - it is how to this request_path will be processed in Magento internally
Created products are reacheable on frontend by next urls:
Product 1:
magento2.1.local/product-1.html
magento2.1.local/cat-1/product-1.html
Product 2:
magento2.1.local/product-2.html
magento2.1.local/cat-1/product-2.html
Up Magento version to 2.1.3
Open "Product-1" edit page in Magento admin panel. Change "Search Engine Optimization > URL Key" field on "product-1-2" (Create Permanent Redirect for old URL is checked). Save product.
Db state after steps:

Our products are reacheable on frontend by next URLs:
Product 1:
magento2.1.local/product-1.html will be redirected(301) on magento2.1.local/product-1-2.html
magento2.1.local/cat-1/product-1.html will be redirected(301) on magento2.1.local/cat-1/product-1-2.html
magento2.1.local/product-1-2.html
magento2.1.local/cat-1/product-1-2.html
Product 2:
magento2.1.local/product-2.html
magento2.1.local/cat-1/product-2.html
So, all works properly.
Okay maybe i can explaine it better now ,
part 1

part 2

* Part 3 *

Thanks
I was able to reproduce the issue.
Created internal issue MAGETWO-64191 to investigate and track this issue.
Thanks in advance
@naydav is there a fix in magento 2.1.4 ?
@naydav Same problem in Magento 2.1.4 !
I have similar problems. It seems to be related to updating the website attribute of the product. I have a product with 4 url_key values set at storeview scope and 2 url_key values at default scope. At first the product seems oke. All 6 url_keys are stored in the url_rewrite table and all is fine.
When I mass-update this product via the backend, and I allocate the product to my website (again, as it already was allocated to it) then all url_rewrite entries dissappear except for those whose url_key value is set on default scope.
So triggering an update of this 'website' attribute is causing url_rewrite entries to dissappear somehow.
I developed a solution that can regenerate the rewrites using the CLI, which fixes the above for me. Contact me if you need it.
I need it thlassche!
@heresh80 Can't find your e-mail, please drop me an e-mail on [email protected]
Hi, I'm using magento 2.1.7 with 2 stores and it happens to me to products that are in both websites.
Is there any update?
@philipvandebriel, thank you for your report.
We've created internal ticket(s) MAGETWO-75585 to track progress on the issue.
We have 2 M2 instances where we are getting this issue -
A product on the M2 instance is allocated to two websites, it has not been modified for nearly a year (the timestamps on catalog_product_entity) and was working fine on both sites. At some point recently the URL of the product has reverted to catalog/product/view/id/1083/s/..... form on ONE of the websites, on the other it is still fine. Checking the url_rewrite table shows that the entries for this product on the affected site are all gone.
It sounds like our issue is related to this open issue but the rewrites are being deleted without the product being updated - does anyone have any comments?
Same here!
In our case, the store has been migrated from M1 using the data migration tool. We haven’t yet checked on a fresh M2 install with sample data…
Hi @philipvandebriel. Thank you for your report.
The issue has been fixed in magento/magento2#13567 by @adrien-louis-r in 2.2-develop branch
Related commit(s):
The fix will be available with the upcoming 2.2.4 release.
Hi @philipvandebriel. Thank you for your report.
The issue has been fixed in magento/magento2#14252 by @rostyslav-hymon in 2.3-develop branch
Related commit(s):
The fix will be available with the upcoming 2.3.0 release.
@magento-engcom-team those commits you refer to seems to be only test cases rather than the actual fix? I'm trying to backport this to 2.1.12 also...
@OZZlE, quoting myself from the associated PR.
We discovered that, in the 2.2-dev branch, the issue was fixed by side effect in this commit: a0d3a63. This PR just provide the tests we were using when fixing the issue but the fix itself is already merged (see: a0d3a63#diff-4e1fd4e484fc5142fc23f8ef0cde6718L53).
@adrien-louis-r it was another bug in <2.3
Looks like a bug in catalog-search module.
It uses websiteId instead storeId when building tmp search table.
Here is diff comparing to 2.2.3:
Patching this fixed the issue with missing products in grid.
--- ./Model/Search/FilterMapper/TermDropdownStrategy.php (date 1523456583000)
+++ ./Model/Search/FilterMapper/TermDropdownStrategy.php (date 1523456583000)
@@ -98,7 +98,7 @@
'search_index.entity_id = %1$s.entity_id AND %1$s.attribute_id = %2$d AND %1$s.store_id = %3$d',
$alias,
$attribute->getId(),
- $this->storeManager->getWebsite()->getId()
+ $this->storeManager->getStore()->getId()
);
$select->joinLeft(
[$alias => $this->resourceConnection->getTableName('catalog_product_index_eav')],
@magento-engcom-team that is not the fix, that is just an integration test. Could you refer us to the actual commit that fixes it?
Anyone looking to backport this issue, the workaround that worked for me with Magento 2.1.6 was commeting the line 144 of file vendor/magento/module-catalog-url-rewrite/Model/ProductUrlRewriteGenerator.php or app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php, depends on your folder structure
Still trying to find any problems with this approach, none so far
@samuel27m could you link to that exact line in the Github repo? In my 2.2.5 installation that line is return $urls; which I doubt is the line you mean.
@peterjaap yes, exactly that one.
Do you know if there any problem that removing that line can bring up? I've ran many tests creating and removing product URL's but no errors so far.
I am experiencing this on 2.2.4. Can anyone confirm if this issue has been resolved in a later release?
Any other workarounds in the meantime?
This is the easiest and best solution: https://www.ubertheme.com/magento-tutorials/fixing-url-rewrite-after-migrating-magento-2/
I am facing the same issue for the category after upgrading Magento 2.4.0 to Magento 2.4.1
Most helpful comment
@magento-engcom-team that is not the fix, that is just an integration test. Could you refer us to the actual commit that fixes it?