WordPress should handle the 301 redirects for you automatically in this case. It doesn’t always, but it should here.
Long story short, WordPress has a function, redirect_guess_404_permalink which tries to find the correct post when it encounters a 404 by using the end of the 404 url to query against the wp_posts.post_name. If it finds a post, it will perform a 301 redirect. In your particular case, because your old structure ends in %postname%, this should very reliably 301 all your old paths.
Related Posts:
- How does WordPress handle permalinks?
- Removing the redirect after changing a page’s slug
- 301 Redirects for Changed Permalink Structure & Category Base
- URL rewrite based on a custom field value
- How can I force WordPress to redirect to canonical permalinks?
- How do I turn off 301 redirecting posts (not canonical)?
- Subdomains to pages
- How can I include a query string with get_permalink
- Redirect short-form URL to long-form URL (post_id to post_id + post_name)
- Auto 301 to full post permalink? (using /posts/%post_id%/%postname%)
- WordPress on VirtualBox – no pretty permalinks
- Stop redirecting to posts not in a category / duplicate slugs
- WordPress 3.4 Permalinks Redirection Problem
- Random Alphanumeric Key URLs
- Rewrite-Rules not working on a vhost, everything goes to index.php
- Using WP rather than .htaccess to redirect pages/posts
- Does WordPress send a 301 header message when you change permalink structures?
- Top level Pages redirecting to homepage!
- WordPress redirection problem after moving to a new server?
- Specific URL Rewriting with parameters in wordpress
- echo post-permalink without http and www
- Woocommerce Product Attribute Permalink doesn’t work?
- Post incorrectly displaying as page
- wp_logout_url redirects to incorrect page because of pagination
- Need Help Correct Regular Expression Redirect Code
- Infinite redirects after changing the permalink of a page
- Does rename of page slugs create 301 redirects from old slug to new (same as for posts)?
- Changing the post date without causing 404 error
- Change permalinks on move from one site to another
- List / Get post redirects
- Redirect /%year%/%monthnum%/%day%/%postname% [closed]
- Title attributes on Permalinks for posts and products
- Redirecting all posts after changing URL structure with htaccess
- Redirect all posts permalinks from “.html” to “/”
- how to redirect old blog post urls when permalinks are changed
- 301 Redirect for Non-Date Based URL’s
- Rewriting single post url; add_rewrite_rule problem?
- Passing the JQuery string to Worldpress URL
- Advanced author permalinks
- How to use different domains for different blogs hosted in the same host in subdomains with .htaccess
- WordPress 3.1 .htaccess contents keep dissappearing?
- Freeze child page URLs so parent permalink changes don’t give 404s?
- How can I make internal anchor links work with WordPress’s permalinks?
- How To Load an HTML File As A WordPress Page (With No 301/No Redirect)
- Resolve 404 on posts without category
- What causes /pages/ to appear in URI, and how to remove it?
- How do I reclaim either deleted pages or their permalinks?
- Media/attachment urls don’t redirect with fake URL structure
- Some Pemalink problems, probably caused by wrong .htaccess configuration?
- Test site pages go to main site
- Strange behavior with a redirect loop – involves WPML multi-language plugin
- how to find duplicated permalinks?
- Redirect From Url To Url
- I’ve removed my /author/ slug but it clashes with new and existing pages. Any fixes?
- After cloning WP do a subdirectory, I can’t access it
- change WordPress permalinks and redirect new urls 301
- Arabic permalink redirect to home page
- Configuring Home Page Address
- Redirect after permalink changes
- Passing variable as permalink URL
- Blogger To WordPress Permalink Redirection
- new page redirect to old page which had the same permalink
- replacing post ID by custom post name in url
- Permalinks and page store
- All pages load the home page if pretty permalinks are used
- Change url of page according to my requirements in wordpress
- How to redirect old permalinks from https://exmaple.com/category/post_id to https://exmaple.com/category/post_id.html
- corrupted URLs – can’t leave starting page
- Find all URLs for a post
- How can i fix my permalinks?
- remove SLASH on single_post but KEEP on categories and parent pages
- where can i see wordpress automatic redirect History
- Redirect old /%category%/%postname%/ to just /%postname%/
- Extending page urls without getting a 404
- 301 redirects after changing permalinks
- How to experiment with permalink structure on a select number of posts
- Change permalink structure with post id
- redirect any category in URL to the ID and post-name only – hundreds of pages affected
- Post redirected to page with same name but DIFFERENT permalink
- Changed Permalinks settings, how do I redirect posts on Nginx?
- Post permalinks go to the home page
- Add a product attribute to permalink in WooCommerce
- Can’t access WordPress site in subfolder possibly because of .htaccess redirect from root installation?
- changing permalink gives 404 error for old links
- All pages lead to home
- Removed and Reinstalled WordPress, Redirect Broken now
- Permalink structure as code in back-end?
- redirect old pages by .htaccess
- URL to an image in a post is changing when permalink is set to custom. Can I avoid this?
- Why are all pages redirecting to homepage when using custom permalinks?
- Redirecting From An Old Permalink Structure
- .htaccess regex for redirect subdomain to root domain & redirect old permalinks
- Redirect Loops Problems
- 301 Redirect posts to newly added categories
- Pages resolve at different URLs (different capitalizations)
- WordPress not remembering old slugs for pages
- Redirection after Category Change for Custom Structure
- Changing permalink won’t redirect to new version of page
- Removing /wp in Permalink URL of subdomain led to inaccessibility to WP Dashboard
- Permalinks and redirects