0

I want to change my url to the endpoint of slug on categories. Ex:

www.example.com/level1/level2/level3.html

should be like this:

www.example.com/level3.html

1

We can configure it by URL Rewrites

  1. Go to Magento 2 Admin -> Marketing -> SEO & Search -> URL Rewrites
  2. Find the path by searching Request path column.
  3. Remove the cache php bin/magento cache:clean.
  4. 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

\vendor\magento\module-catalog-url-rewrite\Model\CategoryUrlPathGenerator.php

Modify getUrlPath($category) by Magento Plug-in feature.

Magento 2 - How to remove parent categories slug from subcategory URLs to make it shorter?

  • Thanks for your response, could you please give me the code for getUrlPath($category)? what should i paste? – MGPM Feb 4 at 8:36
  • if In feature if you are using plug-in than u need to modified. – Anas Mansuri Feb 4 at 8:55
  • No i have not any plugin, just need to override Magento – MGPM Feb 4 at 9:16
  • please click above url, there have some one is created module. – Anas Mansuri Feb 4 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.