(Oops.. In my haste, I made a boo boo.. I corrected it.. the post is correct now)
It happens to all of us at one time or another. We decide to change our permalink structure and something / everything breaks in WordPress. Not because of the fact that we changed the structure, but everybody and everything that linked to our old links are now getting 404 errors (page / content not found).
This is a REALLY BAD THING. It could seriously hurt your traffic. So what is one to do?
Support more than one permalink structure! You can do it in .htaccess by simply using a wonderful tool called regex.
For example, in my case, let’s say I had a link that was: http://xyz.com/2012/05/foo
(foo being the postname) and I changed the permalink structure to be:
http://xyz.com/foo
It would wreak havoc on my world due to the fact that everyone that linked to /2012/05/foo would get an error.
We fix this by using a regular expression in .htaccess and place it above the ### WordPress Start ### stanza.
Just simply insert the following line:
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://xyz.com/$3
That’s it! Every request that comes in with a 4 digit number / 2 digit number / postname is permanently redirected to: http://xyz.com/postname
Obviously, you can support all of the default wordpress permalink permutations by using that same concept by placing multiple RedirectMatch 301 lines in there.
Just use what you need and save the computing cycles though. You should see all your 404 redirect / page / content not found errors go away! Visitors will still get their content and you get to keep your new permalink structure!