How to Remove Category Path from Product URL in Magento?

There are a lot of aspects of Magento SEO you need to pay attention to. The URLs are what you can start with. Once you configure the store URLs of your Magento website, you might also want to edit the way your product links look like.

Depending on your SEO strategy, you might need to remove the category path from product URLs in Magento. There are various reasons for that, like avoiding duplication or trying to shift the main focus on the product.

Fortunately, Magento 2 gives you a chance to achieve these goals. So, today you'll learn how to disable the category path in Magento product URL.

To remove category path in Magento product URLs:

1. Go to Stores > Settings > Configuration > Catalog > Catalog and unfold the Search Engine Optimization section.

2. Choose No in the Use Categories Path for Product URLs field.

Disabling the categories path in Magento URL

3. Press the Save Config button and flush the Magento cache. Now you can check the results on the front end.

Magento product URL with and without categories path

Note: in some cases, you might also need to reindex Magento to see the applied changes. 

You can remove category paths from product URLs in Magento with little to no effort. But still, you should analyze whether it fits into your SEO strategy to make sure that you'll benefit from applying it.

Yet, you need to remember that even if you keep categories in the product URL, Magento won't show them in the canonical tags