seo – How to change the structure of my URLs together with the Sitemap for a live website?

I am changing the URL of my website to improve SEO. The current site map contains URL like this:

mysite/browse/1    /* 1 is the ID for fashion */
mysite/browse/2    /* 2 is the ID for real estate */

Now I have changed the URLs to the following format:


I have the code ready to be launched along with the new site map. If I release the new code, the old URLs would no longer be valid, that is: mysite/browse/2 would return "404 – page not found".

I think I have to release the code and send the new site map to Google Search Console. But I think it would take Google some time before crawling the new sitemap, so during this time, all my old URLs that appear in the search result will return the "404 – page not found" error.

How can I mitigate this situation?