I fixed the urls, but i see an other problem. Why when i open some product on the homepage the url is “domain.com/product-name” and when i open it from category, the url is “domain.com/category1/category2/product-name”? And the caconical is domain.com/product-name.
Same is with categories. I have domain.com/category1/category2/ and the canonical is domain.com/category2. Why?