URL Optimization after Migration for Magento 2

URL Optimization after Migration for Magento 2
Magento Edition
Pro installation
  • 231
  • 169
  • 5

Migration from Magento 1 to Magento 2 often leads to a problem to save some categories on the backend. There appears this unavoidable error “URL key for specified store already exists”. Our team has thoroughly investigated the problem and come to a conclusion there is no unified and reliable solution to thrash out the problem. Even if you managed to remove all duplicated URLs, the error would surface again after another "Save" procedure.

The extension can help you remedy all post-migration defects relating to URLs. Just in one SSH command. As a result of it, you get:
• all URLs unique
• properly regenerated url_rewrite table (Reindex URL Rewrites)
• bug-free Magento 2 in terms of URLs


There are numerous reasons for the error “URL key for specified store already exists”. We can name the most prominent one, which is the fact there must be some overlapping URL keys between products, categories, and CMS Pages. Magento 1 is indulgent to such cases and would solve the dilemma with duplicated URLs by appending [url_key]-1, [url_key]-2, etc. Magento 2, in turn, considers any duplication as an error.

Migration process involves hundreds or even thousands of duplicated URL keys to wander from Magento 1 to Magento 2. This makes the problem totally immense. To make it worse, the problem can't be addressed by just making URL keys unique. The “url_rewrite” table, as well as the “URL Path” attribute, has to be generated anew.

Furthermore, the indexing procedure is usually accompanied by various code issues of Magento 2. We keep this situation under control with the help of the extension. Hence, if you decide to remove the plugin after solving the problem with URLs, the errors will find their way back to your Magento 2 again because there will be nothing to stop them.

How to Use

Install the extension following the instruction.
Enter the console and run the command "php bin/magento" to make sure the new commands are available:
php bin/magento url-optimization:optimize-all
php bin/magento url-optimization:optimize-all-force
php bin/magento url-optimization:unique-url-keys
php bin/magento url-optimization:generate-url-rewrites*

*A complete optimization effect can be achieved by running just a single command:
php bin/magento url-optimization:optimize-all
The other 3 commands are additional tools for developers mostly. The 'force' command skips forming a MySQL transaction, which might be helpful in case of issues with DB.

The flow of a URL optimization process is displayed in detail in the console and, for convenience, logged in:

Should you have any difficulties you may need help with or any questions, we're always happy to assist (support).


  • Utterly addresses the issue with saving of category when “URL key for specified store already exists”
  • Capable of making all "URL Keys" unique (works with Products, Categories and CMS Pages in any combination)
  • Properly regenerates the "url_rewrite" table
  • Fixes a Magento 2 problem with spontaneous duplicating of "URL Path"
  • Addresses an issue with the suffix "/" for categories and/or products



Magento Open Source (CE) 2.1.x, 2.2.x, 2.3.x, 2.4.x
Magento Commerce (EE) 2.1.x, 2.2.x, 2.3.x, 2.4.x


We provide comprehensive product support for all the Magento extensions available on this site starting from the moment of your purchasing them. If you need help on the extensions installation or on any issues relating to our products, our dedicated team of proven technical experts is at your service, ready to assist you at any time.


new feature bugfix
v.2.4.7 (Jul 26, 2023)
Minor code refactoring.
v.2.4.6 (Jul 30, 2022)
Minor code refactoring.
v.2.4.5 (Jan 21, 2022)
Addressed an issue with category URL keys being considered duplicates if they belong to different root categories.
v.2.4.4 (Nov 30, 2021)
Minor code improvements.
v.2.4.3 (Oct 6, 2021)
Addressed an issue with generating URL rewrites for products without categories assigned.
v.2.4.2 (Aug 11, 2021)
Added support for disabled categories by skipping them during optimization and generating a URL rewrite when re-enabled.
v.2.4.1 (May 6, 2021)
Added support for categories unavailable under certain stores.
v.2.4.0 (May 3, 2021)
Added ability to generate URL path for categories if missing or incorrect.
v.2.3.4 (Mar 19, 2021)
Improved category duplicate validating and updating;
Addressed an issue with generating products without category.
v.2.3.3 (Sep 7, 2020)
Added support for Magento 2.4.0.
v.2.3.2 (Jul 28, 2020)
Added support for Magento 2.3.5;
Improved URL generation by stores.
v.2.3.1 (Dec 20, 2019)
Added support for Magento 2.3.3.
v.2.3.0 (Apr 11, 2019)
Added support for 'Use Categories Path for Product URLs = No';
Added a new command to force optimization.
v.2.2.6 (Mar 7, 2019)
Improved generation for duplicated category URLs.
v.2.2.5 (Feb 21, 2019)
Improved URL generation;
Performance optimization.
v.2.2.4 (Jan 18, 2019)
Added support for Magento 2.3.
v.2.2.3 (Nov 27, 2018)
Improved duplicate URL key detection method.
v.2.2.2 (Nov 2, 2018)
Improved support for CMS pages in multi-store setup.
v.2.2.1 (Jul 20, 2018)
Added exception handling when unable to save entity.
v.2.2.0 (Nov 17, 2017)
Addressed a fatal error when saving categories without URL Paths and with same URL Keys.
v.2.1.4 (Oct 24, 2017)
Added compatibility with Magento Open Source/Commerce 2.2;
Addressed an issue with saving Configurable products without custom options.
v.2.1.3 (Sep 7, 2017)
Addressed an issue with CMS page column name in EE version.
Addressed an issue with generating url rewrites for products without category.
v.2.1.2 (Sep 4, 2017)
General code improvements.
v.2.1.1 (Aug 22, 2017)
General code improvements;
Addressed an issue with DB tables containing prefixes.
v.2.0.0 (Jun 15, 2017)
Initial release.


    It works!
    I have just installed your URL Optimization after Migration for Magento 2 extension couple days ago and it really worked. :) we migrated from m1 to m2 and a lot of our URLs got messed up. My developer was having the difficulty to resolve this issue.
    by Kevin September 2, 2019
    Life saver
    This extension is a life saver after migration. Not sure what is going with URL's when you do migration from M1 to M2, but I dont care anymore, with this tool you can easily sort all url related issues out.

    I definitely recommend it!
    by Ivan 2b1c December 25, 2017
Write Your Own Review

Only registered users can write reviews. Please, log in or register