The URL rewrites of Magento 2 will not be reindexed when rebuilding the index via command line. I recommend using https://github.com/olegkoval/magento2-regenerate_url_rewrites to include the reindex of URL rewrites on the shell. This Magento 2 extensions allows for reindexing all URL rewrites.

After installation, run these 2 commands:

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

Now just reindex as usual, the rewrites will be included.

Reindex URL rewrites
Need help implementing this solution, or still looking for a fix to your Magento problem? Get in touch and I will be happy to help with your project.
Tags: