Home

Awesome

Fisheye_UrlRewriteOptimiser

Overview

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.

Features

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).

Issue

To highlight the issue (and purpose of this module) see the 2 scenarios below

Without module enabled

Without module enabled

With module enabled

Without module enabled

Compatibility

Installation

composer require fisheye/module-url-rewrite-optimiser
php bin/magento module:enable Fisheye_UrlRewriteOptimiser
php bin/magento setup:upgrade

Cleanup

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%';

Contributing

Issues, forks and pull requests welcomed :)