[ad_1]
I am migrating a website to wordpress for a client and the problem is that I have to keep the urls exactly same for SEO purpose. urls of posts are random, some posts goes by date like example.com/2018/09/postname/ while some go by example.com/blog/postname
How do I achieve this?

Why do you need to keep the URL’s exactly the same? You can pass the SEO with a 301 redirect from old post to new post and on the new install make sure settings > permalinks are how you want them. They likely made this change after a while, so the posts before that date kept their link structure. Check to see if that structure ends at a certain date.