User Tools

Site Tools


Sidebar

magento_2:unique_product_url

For more details see how the Unique Product URL for Magento 2 extension works.

Ultimate Guide for Magento 2 SEO URL Rewrite

Provide extra search engine optimization level with Unique Product URL for Magento 2. The extension allows you to avoid duplicate content issues by creating unique product URLs. With the module, you will be able to:

  • Define the length of product URL
  • Set the criteria to choose the appropriate URL length
  • Configure 301 redirect to make pages SEO friendly
  • Exclude custom categories from URLs
  • Optimize breadcrumbs
  • Auto generate rewrites for categories and products

Unique Product URL

General Settings

The module requires only one Magento 2 option to be activated before starting its job. Navigate to: Stores → Configuration → Catalog → Catalog → Search Engine Optimization and set the Use Categories Path for Product URLs option to Yes.

Now, you are ready to proceed with the Unique Product URL for Magento 2 extension configuration.

To get to the extension's settings go to the Stores → Configuration → Amasty Extensions → SEO Single URL section. There are 5 options to get the module up and running.

Categories Path in Product URL — The option allows you to define the preferred length of product URLs.

  • Shortest Path — uses the shortest possible path in product URL;
  • Longest Path — uses the longest possible path in product URL;
  • Default Rule — utilizes the default Magento 2 rule for URLs, deactivates the extension.
  • URL without Categories

By — Here you can tell the extension what method to use when detecting the product URL length. Select between the URL level depth or the Number of characters options.

301 Redirect To Canonical URL — Once you have multiple URLs leading to a single product, you can activate this option to enable automatic redirect to the main canonical URL.

Exclude Category from Product URL — Using this setting you are able to specify category IDs to permanently exclude certain categories from product URLs in your store.

You need to fill in a category ID rather than its name. To find category IDs, go to the Products → Categories section. Then, select a category and check page URL in your browser for required ID.

Generate Breadcrumbs According To — This option provides you with the ability to diversify breadcrumbs on your product pages:

  • Current URL — takes the breadcrumbs elements from product URL, including all categories and subcategories;
  • Last Visited Category — displays in the breadcrumbs section only previously visited categories on the way to the product page.
Please note that the extension doesn't enable full breadcrumbs if they are not available on your site. It just changes their formation logic. For this configuration to work, full breadcrumbs should be displayed by default.

Only Included in Menu categories can be displayed in breadcrumbs.

New URL Structure

When configuration is done, the new URL structure will be the following:

Product URL has the maximum length using the URL depth level criteria. Also, breadcrumbs reflect the current URL. Each product in your store will receive unique URL. That should help you to avoid duplicate content issues and make your store search engine friendly.

URL Rewrites Regenerator

Regenerate URLs rewrites in bulk directly from the Magento 2 admin panel. Run regeneration for all or specific categories and products to make their URLs SEO-friendly.

General Settings

To configure the regeneration process, navigate to Stores → Configuration → Amasty Extensions → URL Rewrites Regenerator.

Enabled - set to Yes to activate the module.

Skip Reindex - choose Yes if you don't want to reindex after each URL regeneration. If enabled, keep in mind that you will have to run reindexation manually when the regeneration process is completed.

Skip Cache Flush and Cache Clean - enable the option to postpone cache flushing and cleaning, similar to reindexation.

Url Rewrites For Categories

Include Categories to Regeneration - set to Yes to rewrite URLs for categories.

Choose Category Range to Regenerate - enable the option if you want to apply URL updates for multiple categories.

Category ID Range to Regenerate - here you can specify the particular range of categories to regenerate (e.g. 1-20)

Choose Category IDs to Regenerate - if enabled, you'll be able to set particular category IDs and implement the changes to them.

Category IDs to Regenerate - provide comma-separated list of IDs to rewrite URLs (e.g. 25,47,56).

Url Rewrites For Products

Include Products to Regeneration - select Yes to add product URLs to the regeneration queue.

Choose Product Range to Regenerate - enable the feature if you want to regenerate links for multiple products at once.

Product ID Range to Regenerate - provide the range or products to process (e.g. 1-200).

Choose Product IDs to Regenerate - enable the option to regenerate URLs for specific products.

Product IDs to Regenerate - fill in comma-separated product IDs (e.g. 12,25, 36).

URL Rewrites Regeneration

Regenerate URL Rewrites for Store Views - choose all store views or a particular one to regenerate URLs.

Start Regeneration - click the button to run regeneration.

Regeneration Process

When regeneration starts, you can keep an eye on the process using the information in popups. If you regenerate URLs for both categories and products, you will see the results separately.

For categories it looks like this:

Click Next Step to regenerate URLs for products and view the results.

Also, if you want to stop regeneration, you'll have to confirm your decision in the warning popup.

If you reload the page or close the window (intentionally or accidentally), the process will still run in the background. You'll see the progress below the Start Regeneration button. Stop the process if needed.

CLI Commands

All extension actions can be executed using the command line. It can be useful in cases of auto-deploy or automatic updates, during which some rewrites may be required.

Available CLI commands:

amurlrewrites:regenerate - running this command without the options will regenerate URL rewrites for all products in all stores. After execution, reindex and cache flushing and cleaning will be executed as well.

Available options:

store-id - start regeneration only for a specific store, e.g store-id = 2;

entity-type - select which entity to process - product or category;

no-reindex - do not start reindex after the command process (by default it starts);

no-cache-flush - do not start the cache flushing (by default it is launched);

no-cache-clean - do not start the cache cleaning;

ids-range - set the range of category or product IDs for regenerating URL rewrites, e.g. 100-123;

ids - specify category or product IDs for regeneration, separated by comma e.g 1,2,3 .

Find out how to install the Unique Product URL extension for Magento 2 via Composer.

Rate the user guide
 stars  from 4 votes (Details)
magento_2/unique_product_url.txt · Last modified: 2023/05/29 14:07 by asemenova