I want to remove the trailing category in magento 2
http://magento2.dev/accessories/tops-women.html
http://magento2.dev/accessories/tops-women/jackets-women.html
instead I want
http://magento2.dev/tops-women.html
http://magento2.dev/jackets-women.html
Best Answer
We can configure it by URL Rewrites
Go to Magento 2 Admin -> Marketing -> SEO & Search -> URL Rewrites
Find the path by searching
Request path
column.Remove the cache
php bin/magento cache:clean
.Refresh the front-end, click the main menu category then you can see the configured path.
Example i have modified.
Request path
men/tops-men/tees-men.htm
Modified path
tees-men.htm
Or
You Can Build category URL path by
Modify
getUrlPath($category)
by Magento Plug-in feature.Hope this helps.