Homepage Shows 404 After a Magento 2 Product Import
After importing products or running the migration tool, some stores suddenly show a 404 on the homepage. The cause is usually one or more rows in the url_rewrite table with an empty request path, which then hijack the root URL.
Remove the blank rewrites
Back up the table, then run:
DELETE FROM `url_rewrite` WHERE request_path='';
Rebuild and clear caches
php bin/magento indexer:reindex php bin/magento setup:upgrade php bin/magento cache:clean php bin/magento cache:flush
Need a second pair of eyes on this? Our team handles Magento development every week. See how we can help.