Magento 2 Duplicate Product URL Key Issue: Fixed !!

Problem

Magento creates different URLs for products across different sections of the site such as cross-sell, up-sell, related products etc. Having several different URLs for a single product creates a duplicate content issue for search engines like Google which is not good for the SEO of your store.  

Cause

More often than not stores tend to display the same product at various pages of the website. In Magento, different URLs are created for a product if it is displayed on different sections or different pages of the website. 

Now search engines such as Google crawl your store for products. If it finds several links for the same product then it recognises them as a duplicate content. When indexing websites duplicate content can badly affect the Search Engine Optimization of your store. Bad SEO means fewer visitors directed to your store and that, in turn, leads to fewer sales and profits.

In Magento 2 you can have multiple category paths for a particular product. For instance, you can have a particular t-shirt in the category path Mens>Tops>Tees and you can have the same t-shirt in the category path Mens>Gifts. you can reach a particular category page using different URLs:-

http://URL_OF_Website.co.uk/catalog/category/view/id/23 and, http://URL_OF_Website.co.uk/categoryURL.html

You can reach a particular product page using multiple URLs such as

http://URL_OF_Website.co.uk/catalog/product/view/id/120 or, http://URL_OF_Website.co.uk/catalog/product/view/id/120/category/23 or, http://URL_OF_Website.co.uk/productURL.html or, http://URL_OF_Website.co.uk/category_path/productURL.html or, http://URL_OF_Website.co.uk/secondary_category/productURL.html

It is imperative for e-commerce stores to have a good ranking on search engines if they want better promotions and sales.  Each product needs to have the same URL across the entire store so that it can help search engines index properly and resolve the content issue. However, sadly there is no such feature in Magento 2. Let us look at how you can resolve it. 

Workaround

You can use Magento 2 SEO Unique Catalog URLs extension to get a workaround this critical issue. Please follow the steps below to create a unique product URL. 

Step 1:- Install the Magento 2 SEO Unique Catalog URLs extension. 

Step 2:- Log in to your admin panel and go to Stores>Configuration>Scommerce Configuration> Catalog URL. Enable the extension and exclude any categories that you want. Remember to clean the cache after saving the configuration. 

Unique product URL configuration

Step 3:- Go to Catalog>Products and select the product that you want to create a unique URL for. 

catalog products

Step 4:- Scroll down on the product settings page until you find Primary Category. In the dropdown select the primary category that you want to be in your unique URL. In this case, we have Gear. Once done click on  Save. 

Product settings

Step 5:- You should see the unique URL for the product on your frontend no matter where you open the product. For instance, first, we open this product by going into Gear>Bags and then clicking on the product. Second, we directly search for the product using SKU. As you can see in the image below both the pages have the same URL.

Troubleshoot

If even after following all the steps above you do not get the result then its probably because of the Magento’s default settings. Go to Stores>Configuration>CATALOG>Catalog. Then find the Search Engine Optimization option and click on it. Scroll down to find Use Catagories Path for Product URLs. Make sure it’s enabled because without this you won’t be able to see your category path in the unique URL. 

include categories in URL

Discover more from WHO WILL CARE eCommerce

Subscribe now to keep reading and get access to the full archive.

Continue reading