We migrated blog posts from an old WP site that was using Month and name permalink structure. The new site is using Post name permalink so anything with YEAR/MO format in url is not found in Webmaster tools.

Ultimately, we want anything not found that looks like this:

/2012/05/post-name/

to redirect to this:

/post-name

Is there a way to either write a redirect with wildcards that targets the year and month and redirects all to the Post name permalink? Or another plugin or technique we can use within WP? any other ideas or suggestions welcome. Thanks.

1 Answer
1

Yoast SEO Redirect Creation tool will allow you to generates the code you need to manually add to your site’s .htaccess file to redirect all the posts to the new /%postname%/ structure.

Enter your site URL, Your old permalink structure and click generate redirect on SEO tool website page. Add generated code to top of your .htaccess

Your Redirects Rule should be:

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$ YOUR-DOMAIN/$3

Leave a Reply

Your email address will not be published. Required fields are marked *