I want to change the permalinks from /%postname%.html
to the default ?p=%post_id%
permalink. I know how to change the permalink structure that from WordPress admin panel.
However, I have over 30000 posts and I want to make sure that people who visit the old URLs will be redirected to the new.
For example:
http://example.com/sample-post.html
would redirect to http://example.com/?p=123