Why the redirect map matters
Every old URL that has links, rankings or bookmarks should either stay the same on the new site or redirect permanently to its closest new page. One that returns 404 after launch breaks every link pointing to it.
In Next.js, redirects() in next.config.js returns a list of rules, each with a source, a destination and permanent: true, which sends a 308 permanent redirect. Redirects run before pages and files in /public.
What the builder checks
A chain is a redirect that lands on another redirect; the builder points the first URL straight at the final page. A loop sends a URL back to where it started, so it is left out. A source listed twice keeps its first rule.
Next.js removes trailing slashes by default before your own redirects run, so sources and destinations are written without them. A query string can't go in a source, so it is matched with a has condition. Old URLs on your domain become paths; another domain is kept as a full URL and flagged.
WordPress URL patterns
WordPress creates URLs you may not rebuild: category, tag and author archives, /page/2/ pagination, /feed/ URLs and dated permalinks such as /2023/05/slug/. Listed without a new URL, each type gets one pattern rule instead of a line per URL, such as /:year/:month/:slug to /blog/:slug.
Two cases need you. A /?p=123 link uses a post ID, so add the post's new URL after it. Media under /wp-content/uploads/ keeps working with no redirect if you copy the files into public/wp-content/uploads in the Next.js project.