Product URL Key data Import produces 404 page not found error
We were having an issue with broken links to product pages, where the product URL Key was updated via data import.
Apparently, the process of updating the PHP memory limit has resolved the issue we were having with the broken links for all the products in the database that had been previously updated with an imported URL Key. However, URL Key updates that we are importing since the PHP memory limit update are exhibiting the same behavior.
Mode is DEVELOPER
My first question is, should we deploy PRODUCTION mode to resolve issues with product page URLs?
So, here's what happened so far:
(1) The URL Key field in a batch of products in the Magento2 database was updated via a data import. But, these products did not resolve the page link that was supposed to be determined by that field, resulting in a 404 error.
(2) Then, in order to resolve an indexer memory allocation error, we updated the PHP Memory Limit to 1024 MB. This incredibly fixed the issue with the broken links from those above products. No idea why.
(3) Since then, some more URL Key Field updates have been made to products via data import, and the same problem has occurred ... the links to those products produce a 404 page not found error (this is after manual reindex of all indexes and complete magento cache clean and flush).
A work around I have found is to go into each product, changed the URL Key to a different value (i.e. change 'kprv216' to 'kprv-216'), then save (uncheck create permanent redirect), then go back to URL Key, change back to correct value, then save again. This seems to produce a working URL Key. However, there are too many products (2,500) in the database to touch one at time like this.