Redirection Plugin for WordPress, the Regex settings
Redirection WordPress plugin manages all your 301 redirects and monitors 404 errors. Skip the monitoring part and focus on 301 redirections using regular expression or regex. Here are a few examples on the kind of Redirection regex you can use if you want to massively redirect traffic from an older permalink structure to a newer one.
Old permalink structure: http://yourblog.com/2005/05/12/blog-post-title/
New permalink structure: http://yourblog.com/blog-post-title/
From WordPress Admin Panel navigate to Tools > Redirection > Add new redirection and fill in the appropriate fields with these values
Source URL: /(\d*)/(\d*)/(\d*)/(.*)/
Target URL: /$4
(\d*) is a number variable. In the case of the old permalink structure, (\d*) substitutes the year (2005), the month (05) and the date (12) numbers in a URL like this: http://yourblog.com/2005/05/12/blog-post-title/
(.*) is a wildcard variable. In the case of the old permalink structure, (.*) substitutes the string (blog-post-title) in a URL like this: http://yourblog.com/2005/05/12/blog-post-title/
/$4 is the fourth variable in the row which will be used in the new perlamlink structure. In this case /$4 will read (.*) which is blog-post-title and echo it
Visit Google Webmaster Tools and check your 404s. It is highly possible that you will need to add an extra redirection similar to the previous sans the slash at the end of the URL. The new redirection will look like this:
Source URL: /(\d*)/(\d*)/(\d*)/(.*)
Target URL: /$4
[photo]
