2

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.

2
  • Did you check that the problem is not more simple, such as checking in your admin panel that you permalinks setup is the same as it was? Sounds to me like you had the permalinks set to /%year%/%monthnum%/%postname%/ Commented Sep 28, 2016 at 20:36
  • Ya, we ended up just using same permalink structure. Wondering which is better for SEO though.
    – frshjb373
    Commented Sep 28, 2016 at 21:24

1 Answer 1

4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.