URL reWrite
Get the expected Magento2 Product URL Key value
Sometime you want to know the expected URL Key for an product to see if it will be okay not not, the best way I have seen is to see how Magento itself create it, for that the easy way is to create a new product with any name and get the product id , then load the product ... see below
How Magento2 format the product URL
I have looked at almost 100 articles to know how Magento format the URL without any success and finally I found it and it was really so easy , here is the quick way to see it using object manager
Note: please consider to use the dependency injection
$_productloader = $objectManager->get('\Magento\Catalog\Model\ProductFactory'); $product = $_productloader->create()->load(1); echo $product->formatUrlKey({Your text here});
in this way Magento will give you the correct URL which will be used