Magento 2 – Homepage is 404 after migration

In some cases,

TheΒ categories entityΒ had an emptyΒ request_path.

Go to the database and with the help of this command find theΒ categories or productsΒ entities that have an emptyΒ request_path

SELECT * FROM `url_rewrite` WHERE request_path='';

Delete all those entries and use the cache clean and flush command:

php bin/magento cache:clean
php bin/magento cache:flush

Revisit theΒ url, and the homepage will work fine once again.