Setup redirects for product links after migrating from wordpress to opencart

I am migrating from woocommerce to opencart and I want to keep my SEO. But there is a problem with that because the url patterns of the two platforms differ. For example woocommerce uses and when I move that to opencart it changes to or if I enter in the product from other page like the home it just adds the product slug to the url. If there is a link to the product in and I click it it will lead me to etc. I have many products for which I want redirects, so I can keep my SEO. How can that be done ?