I cannot figure out what settings would prevent this from happening. Also cannot figure out how to fix the urls that have been set this way already. Thanks Sam
We fixed the URL's like this:
- Remove all product related rewrites from url_rewrite table
- Mass update all products in admin (select all, update, set website as default)
- If problem still exists, run this MySQL command:
UPDATE url_rewrite SET request_path = REPLACE(request_path, '.html.html', '.html')
WHERE url_rewrite.request_path like '%html.html';
Then clear the caches.
This is more of an addition to @Webninja's answer, as his steps might solve the issue for others. Consider this a work-around and not a fix. Since it's a known bug in Magento 2.
In our case the mass update caused the double suffix to re-appear after saving a product or category, so the URLs were generated incorrectly. Our products were also imported from a Magento 1.x install.
UPDATE-query mentioned in his post didn't work, due to duplicate entry errors.
So, what I did was the following:
- Remove all product related rewrites from url_rewrite table (
DELETE FROM url_rewrite WHERE entity_type = 'product';)
- Remove the Product URL suffix (.html, in my case) and leave the field blank in stores > configuration > catalog > catalog > search engine optimization;
- Mass update all products in admin (select all, update attribute, check the box underneath 'Add product to website')
- In case mass update gives errors ('something' already exists) you can also save each main category (not root, one or two levels (depending on your setup) underneath) seperately. The URLs will also be regenerated then.
Now the URLs are correctly generated at each save of a product or category.