A Magento module that stops URL rewrites with category paths being generated for products when 'Use Categories Path for Product URLs' setting is disabled in config.
A Magento module that stops URL rewrites with category paths being generated for products when 'Use Categories Path for Product URLs' setting is disabled in config.
Note: this extension will only prevent category path based URL rewrites from being created. Removing existing URL rewrites will need to be managed separately (though may be added in a future version).
To highlight the issue (and purpose of this module) see the 2 scenarios below
url_rewrite
table could be huge!composer require fisheye/module-url-rewrite-optimiser
php bin/magento module:enable Fisheye_UrlRewriteOptimiser
php bin/magento setup:upgrade
If you installed this extension to prevent product rewrites with a category path being generated and you want to clean up your existing rewrites by removing them, run this query;
DELETE FROM url_rewrite
WHERE is_autogenerated = 1 AND request_path LIKE '%/%'
AND target_path LIKE '%/category/%' AND target_path LIKE '%/product/%'
AND entity_type = 'product' AND metadata LIKE '%category_id%';
Issues, forks and pull requests welcomed :)