I made a site some time ago and after some days some posts were indexed by search engines. Today I changed the permalink structure from /%postname%/
to /%category%/%postname%/
.
After that, when people come to my site from search engines a 404 page not found error
appears. I want to change all old URLs to the new category base URL without any 404 error.
How can I do it?
By the way, I use Yoast plugin.
That happens because WordPress reads your old post name as category name now – and it cannot find that category.
Solution: filter
404_template
and try to find the post and its permalink. Then redirect.You need to add 301 redirects from your old page urls to the new ones.
This plugin should accomplish what you want: http://wordpress.org/extend/plugins/redirection/
Because it detects changes to your permalinks and automatically adds redirects, you will need to switch back to your old permalink structure, activate the plugin, and then update your permalinks to the new structure.
Hope this helps.