1

I Need a module or solution that can change Magneto2.1.9 URL generator.Actually want my URL to be like

This https://www.example.com/folder/product-name-SKU

the folder is my stores.

Right now it generates just by name(not name and SKU) by default.

If anybody knows about google Search Engine Optimization new URL structure.

2
  • while product add,place the product name and sku in the product url.. thats it Commented Jun 11, 2018 at 7:20
  • Thanks for your comment, but i want to set it automatically, not 1 by 1.
    – MGPM
    Commented Jun 12, 2018 at 5:19

2 Answers 2

0

You can simply override the vendor/magento/module-catalog-url-rewrite/Model/ProductUrlPathGenerator.php

override the below function in your module

function prepareProductUrlKey()

Replace the line number 138

from

return $product->formatUrlKey($urlKey === '' || $urlKey === null ? $product->getName() : $urlKey);

To

return $product->formatUrlKey($urlKey === '' || $urlKey === null ? $product->getName() . "-" . $product->getSku() : $urlKey);
0

You can use mageplaza URL generator extension...
it has all your requirements.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.