How To Configure Product URLs In Magento 2

flat screen computer monitor and keyboard beside leafed plant

Configuring product URLs in Magento 2 may seem like a daunting task, but it is actually a simple process that can be done in a few steps. In this article, we will guide you through the process of configuring product URLs in Magento 2.

Speed Up Your Magento Store by 300%

Understanding Product URLs in Magento 2

Product URLs in Magento 2 are made up of two components: the base URL and the product URL suffix. The base URL is the web address of your online store, while the product URL suffix is a string of characters that is added to the base URL to create a unique URL for each product.

By default, Magento 2 uses the product name as the product URL suffix. This means that if you have two products with the same name, they will have the same URL, which can lead to confusion for both users and search engines. To avoid this, it is important to configure product URLs in Magento 2.

Step 1: Change the Product URL Key

The first step in configuring product URLs in Magento 2 is to change the product URL key. The product URL key is a unique identifier for each product that is used to create product URLs. By default, Magento 2 uses the product name as the URL key, but it is recommended that you change this to something more unique.

To change the product URL key, follow these steps:

  1. Open the product edit page in your Magento 2 admin panel.
  2. Scroll down to the "Search Engine Optimization" section.
  3. Click on the "URL Key" field to edit it.
  4. Change the URL key to something unique and descriptive of the product.
  5. Click the "Save" button to save the changes.

Step 2: Configure the Product URL Suffix

The next step in configuring product URLs in Magento 2 is to configure the product URL suffix. The product URL suffix is a string of characters that is added to the base URL to create a unique URL for each product. By default, Magento 2 uses ".html" as the product URL suffix, but you can change this to something else.

To configure the product URL suffix, follow these steps:

  1. Open the Magento 2 admin panel.
  2. Go to Stores > Configuration.
  3. In the left-hand menu, click on "Catalog" under the "Catalog" section.
  4. Expand the "Search Engine Optimization" section.
  5. In the "Product URL Suffix" field, enter the desired suffix (e.g. .html, .php).
  6. Click the "Save Config" button to save the changes.

Step 3: Update the URL Rewrites

The final step in configuring product URLs in Magento 2 is to update the URL rewrites. URL rewrites are used to create user-friendly URLs for products, categories, and other pages on your site. By default, Magento 2 automatically updates the URL rewrites when you change the product URL key or suffix, but you can also manually update them if needed.

To update the URL rewrites, follow these steps:

  1. Open the Magento 2 admin panel.
  2. Go to Marketing > SEO & Search > URL Rewrites.
  3. Click on the "Add URL Rewrite" button.
  4. Select "Custom" as the "Create URL Rewrite" option.
  5. Enter the following information:
    • Request Path: The product URL key with the product URL suffix (e.g. my-product.html)
    • Target Path: The URL of the product page (e.g. /catalog/product/view/id/12345)
    • Redirect Type: "No"
    • Store: The store view for which you want to apply the URL rewrite.
  6. Click the "Save" button to save the URL rewrite.

Conclusion

Configuring product URLs in Magento 2 is an important step in optimizing your online store for search engines and improving the user experience for your customers. By following the steps outlined in this article, you can easily configure product URLs in Magento 2 and ensure that each product has a unique URL that accurately reflects its name and description.

Scroll to Top