Product urls are displaying with category and product id
Now url is displaying like below http://localhost/magento2/catalog/product/view/id/1234/category/12/
But i want http://localhost/magento2/test-product
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Try to edit 1st level or 2nd level categories and simply save it and it will generates rewrites for products assigned to that category. This worked for me when i migrated store from Magento 1 to Magento 2.
We can configure it by URL Rewrites
Go to Magento 2 Admin -> Marketing -> SEO & Search -> URL Rewrites
Find the path by searching
Remove the cache
php bin/magento cache:clean.
Refresh the front-end, click the main menu category then you can see the configured path.
You Can Build category URL path by
getUrlPath($category) by Magento Plug-in feature.
Hope this helps.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0